At 07:20 AM 1/7/2002 -0600, phantom wrote:
>Hey all,
>I am using the Zhang session method from
>  and it works great
>with a mysql database.
>Does anyone out there know how to tell if a session is expired using
>this method?

Yep.  The "expiry" field is equal to the UNIX timestamp at which the 
session will expire.  To get a list of sessions that have already expired, 
you can use this:

$query = "SELECT * FROM sessions WHERE expiry < " . time();

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

That sounds about right.  You might want to try:

if (!session_is_registered("NameOfUser")) {
         //restart session

Although I don't know if that function is reliable with the custom session 
handler...I think it should be though.

I've been using that exact same session handler for several weeks in one of 
my scripts and it works great....

PHP General Mailing List (
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