I used a variation on this and it appears to work for my code. I replaced:
PHP Code:
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-/ . . .
with:
PHP Code:
<?php
session_start();
if(isset($_SESSION['time'])){
if(time() - $_SESSION['time'] > 1200){ //20 mins
unset($_SESSION['approved']);// force new login
}
}
$_SESSION['time'] = time(); //update last page load time
// Rest of code
?>
<!DOCTYPE html PUBLIC "-/ . . .
I think I need another isset to check that 'approved' is set before unsetting it.
I'm still wondering if and under what circumstances the session expires when the user closes the browser. It appears that it expires regardless of any time elapsed, except in Firefox (possibly others that support saving open pages) if the browser is closed with the page open and the user elects to save pages.
And I'm wondering, if the user visit a series of pages with session_start() at the beginning, does that reset the 180 minute (or whatever it's set to in php.ini) counter of session.cache_expire to zero each time?
Bookmarks