I have an online system and need a user to be logged out after 60 minutes of inactivity.
Now the current code works out what 30 minutes less is by.
$cut = time() - 30*60;
Now I would have thought the following would remove an hour so the time out is 60 minutes.
$cut = time() - 60*60;
This is a the full code that happens. After 60 minutes of inactivity I need the person to be logged out.
// Time out Users 60 minutes
$last = $_SESSION['time'];
$cut = time() - 60*60;
if ($last < $cut)
{
session_destroy();
$get = $_GET;
$location = 'login.php?timeout=true';
foreach($get as $key => $item)
{
$location .= '&'.$key."=".$item;
}
header('Location: '.$location);
}
else
$_SESSION['time'] = time();
Now that code does not work i don't think.