Tag: Logout automatic

PHP Automatic Session Logout

Automatic logout script if users have inactive more than 15 minutes [php] <?php session_start(); $inactive = 900; // Set timeout period in seconds if (isset($_SESSION[‘timeout’])) { $session_life = time() – $_SESSION[‘timeout’]; if ($session_life > $inactive) { session_destroy(); header("Location: logoutpage.php"); } } $_SESSION[‘timeout’] = time(); ?> [/php]

Permanent link to this article: https://blog.openshell.in/2011/09/php-automatic-session-logout/