Possible Duplicate:
How do I expire a PHP session after 30 minutes?
I'd like to kill a session after a user has been inactive for 20 minutes.
Possible Duplicate:
How do I expire a PHP session after 30 minutes?
I'd like to kill a session after a user has been inactive for 20 minutes.
Build this into your code wherever appropriate:
session_start();
// 20 mins in seconds
$inactive = 1200;
$session_life = time() - $_session['timeout'];
if($session_life > $inactive) {
session_destroy(); header("Location: logoutpage.php");
}
$_session['timeout']=time();
This will check how much time has passed since the last request, if it is greater than 20 minutes it is destroyed.
PHP will kill a session automatically after 24 min of inactivity.
I doubt 4 min makes so much difference.
Just use default settings and you'll be fine, no special actions needed.