note 71394 modified in ref.session by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 16:47:08 +0000 |
| Subject: | note 71394 modified in ref.session by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142200@lists.php.net to get a copy of this message | ||
If you want the simplest way there is to log a session out after 30 minutes (or any other period of
inactivity) simply add a second line after session_start(), like this:
<?php
session_start();
setcookie("PHPSESSID",$_COOKIE['PHPSESSID'],time()+1800);
?>
Where 1800 is the time in seconds before the session should expire. PHPSESSID is the default session
ID. This way, every time a user loads a page they get their session extended.
--was--
If you want the simplest way there is to log a session out after 30 minutes (or any other period of
inactivity) simply add a second line after session_start(), like this:
session_start();
setcookie("PHPSESSID",$_COOKIE['PHPSESSID'],time()+1800);
Where 1800 is the time in seconds before the session should expire. PHPSESSID is the default session
ID. This way, every time a user loads a page they get their session extended.
http://php.net/manual/en/ref.session.php