Return to Snippet

Revision: 44817
at April 19, 2011 05:22 by scottwatkins


Initial Code
<?php $_SESSION['last_seen'] = time();//Update this value on each user interaction. ?>

<?php
//Get the session id from file name and store it into the $sid variable;
session_id($sid);//try to resume the old session
session_start();
if (isset($_SESSION['last_seen']) && $_SESSION['last_seen'] > $timeout){//Session is expired
  //delete file
  session_destroy();
}else if (!isset($_SESSION['last_seen')){ //already garbaged
  //delete  file
  session_destroy();
}
?>

Initial URL
http://stackoverflow.com/questions/4753687/find-out-if-a-session-with-a-particular-id-has-expired

Initial Description

                                

Initial Title
php - Find out if a session with a particular id has expired. - Stack Overflow

Initial Tags

                                

Initial Language
PHP