Zhang Session Expiration

From: Date: Mon, 07 Jan 2002 13:20:11 +0000
Subject: Zhang Session Expiration
Groups: php.general 
Request: Send a blank email to php-general+get-79686@lists.php.net to get a copy of this message
Hey all, I am using the Zhang session method from http://www.phpbuilder.com/columns/ying20000602.php3 and it works great with a mysql database. Does anyone out there know how to tell if a session is expired using this method? The Read Session function is: \\---------------------------------------; function sess_read($key) { global $SESS_DBH, $SESS_LIFE; $qry = "SELECT value FROM Sessions WHERE sesskey = '$key' AND expiry > " . time(); $qid = mysql_query($qry, $SESS_DBH); if (list($value) = mysql_fetch_row($qid)) { return $value; } return false; } \\---------------------------------------; So if session is expired, this script will return nothing (per the expiry WHERE clause). Say I had placed a variable called $NameOfUser in the session data using session_register($NameOfUser), if the session is expired, would I be able to know that it was expired by using isset($NameOfUser) after running the session_register($NameOfUser) in the script?? Thanks.

« previous php.general (#79686) next »