Limit ID login time.

Newbie Spellweaver
Joined
Jul 23, 2014
Messages
56
Reaction score
2
Hello RageZone , i am having an big issue with finding an way to limit the login time for example once in 6 hours.
The current script that i have limit only the IP (which can be easly changed) , but the logging screen won't work anymore after making an small change to it.
Could anyone give me an advice please?
 
set a session for the user with an array.
$_SESSION['user'] = array("username"=>$username, "logintime" => time());

Then you know when he logged in.

when you want him online for 6 hours.
you check the logintime each time.

$sixhours = 60*60*6;
if($_SESSSION['user']['logintime'] < (time()-$sixhours))
{
unset($_SESSION['user'];
}



only show the page if $_SESSION['user'] is set.

if(isset($_SESSION['user'])
{
//showpage

}
else
{
//redirect somewhere else

}



ps.

Bit too lazy to add tags, getting ready for work.
 
Back