function sessionTimeout($duration) if (isset($_SESSION['LAST_ACTIVITY']) && (time() -
$_SESSION['LAST_ACTIVITY'] > ($duration * 60))) { // last request was more than x minutes ago, where x = duration session_unset(); // unset $_SESSION variable for the run-time session_destroy(); // destroy session data in storage } } $duration = 40; //40 minute as example sessionTimeout($duration); $_SESSION['LAST_ACTIVITY'] = time();
No comments:
Post a Comment