I 'd like to session destroy when that user for 1 hours dont dont press any key or scroll page and dont go to another or in other words stay in one page for a alot of time
Session Destroy For While User Stay In One Page Without Any Action?
Collapse
X
-
or even some variant of this should help
Code:session_start(); // set timeout period in seconds $inactive = 600; // 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: logoutpage.php"); } } $_SESSION['timeout'] = time();
Note the session_destroy () in this example, it destroys all the session vars as opposed to session_unset which simply clears them.Comment
-
PHP will never get any note of this, since that are client side UI actions that do not make it to the server.I 'd like to session destroy when that user for 1 hours dont dont press any key or scroll page […]
essentially, you do not even need to do anything except setting the session GC to the appropriate values (the session destroys itself after a set time, also called session timeout).Comment
Comment