Created
November 7, 2011 15:59
-
-
Save abidibo/1345352 to your computer and use it in GitHub Desktop.
Recreate a php session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('SESSION_TIMEOUT', '1800'); // 30 minutes | |
session_name('fuckIE'); | |
session_start(); | |
// ...bla bla | |
if (isset($_SESSION['last_activity']) && (time() - $_SESSION['last_activity'] > SESSION_TIMEOUT)) { | |
// last request was more than timeout seconds ago | |
session_regenerate_id(true); | |
session_destroy(); | |
unset($_SESSION); | |
session_start(); | |
} | |
$_SESSION['last_activity'] = time(); | |
// ...bla bla | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment