RE: [PHP] Session Length
| From: | John W. Holmes | Date: | Fri, 17 Jan 2003 19:08:37 +0000 |
| Subject: | RE: [PHP] Session Length | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-132033@lists.php.net to get a copy of this message | ||
> I am using Sessions to secure parts of my website. I need to know if
> there is a way to set a lifetime for these sessions , so that they are
> automatically destroyed when say the user is inactive for 30 minutes.
It's already there, the session.gc_maxlifetime setting (default is 1440
seconds).
Actually, this will only work if garbage_collection works on your
server. It's all explained on the session page.
If gc doesn't work on your system, then register a timestamp in the
session that get's updated with each action. Then just look for
timestamps over 30 minutes old and make them log in again.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/