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??


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to