// set timeout period in seconds
$inactive = 1; // Testing. Change back to 600 when done
// check to see if $_SESSION['timeout'] is set
if(isset($_SESSION['timeout']) ) {
$session_life = time() - $_SESSION['timeout'];
if($session_life > $inactive)
{ session_destroy(); header("Location: index.php"); }
}
$_SESSION['timeout'] = time();
The code above works fine. This code, does not:
// Add time to the user online
$inactive = $inactive + 50;
The problem is, when the user does an action, I want 50 seconds more added to their online time. The code above is executed on the page that the user visits, and adds 50 seconds to the $inactive
variable. So far, it does nothing, and the $inactive
variable does not get the extra 50 seconds.
~Thanks.