Re: Adjusting Session Times

From: Date: Tue, 14 Sep 2010 15:09:26 +0000
Subject: Re: Adjusting Session Times
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-308064@lists.php.net to get a copy of this message
On Tue, Sep 14, 2010 at 10:26 AM, Floyd Resler <fresler@adex-intl.com> wrote: > We just got a client whose requirement is that user sessions expire after 30 minutes of > inactivity.  Our other clients are happy with not having their sessions expire during the work day > (i.e. life is 8 hours).  I am using a MySQL database to store the session data.  My thought is to > adjust the session expiration in the table based on the client currently logged in.  Is this a good > approach or would there be better ways to do it?  And just to clarify: all clients use the same Web > site. > > Thanks! > Floyd I store the date and time of the last page access and the session lifetime in minutes in the database. Then when I fetch the session from the database, the WHERE clause includes a condition that the number of minutes elapsed between the current date/time and the time stored in the session table is less than the session lifetime (maximum duration of inactivity for that session). That way, each individual user could have his or her own session timeout period if needed. Andrew

« previous php.general (#308064) next »