Re: SESSION EXPIRATION QUESTION

From: Date: Sun, 25 May 2003 07:08:40 +0000
Subject: Re: SESSION EXPIRATION QUESTION
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148900@lists.php.net to get a copy of this message
Hi, Sunday, May 25, 2003, 12:30:38 PM, you wrote: D> Hi, D> I am still new to php so bare with me. I currently have a management console D> that requires the user to log into. I was wondering how I could write some D> code that would end the session after a certain amount of time. Thus, if the D> user leaves the window open by mistake, I don't have to worry about a D> foreign user making changes. D> Thanks, D> Dale The most reliable way is to store the session start in your session and do a check to see if the next access has passed your timeout. If it hasn't then update the session start time for a new timeout period. If it has then delete session data and make them login again. You can't rely on php session timeouts as they are very hit and miss as the garbage collection might not take place on every access. (this is to reduce the server load) You still have to set gclifetime to be equal to your timeout though. -- regards, Tom

« previous php.general (#148900) next »