note 26956 added to function.session-cache-expire
| From: | ceres at ceressites dot com | Date: | Tue, 19 Nov 2002 01:44:12 +0000 |
| Subject: | note 26956 added to function.session-cache-expire | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39667@lists.php.net to get a copy of this message | ||
In combination with the session cookie
you can keep the session expire time at server side
the same as the session cookie timeout at client side..
<?
if(!isset($_SESSION)) session_start();
$expire=60*60*24*7*52; # sec, min, hours, days, weeks ?
# Client
setcookie(session_name(), session_id(), time()+$expire, "/");
....
# Server
session_cache_expire($expire);
?>
This works fine for my sites..
--
http://www.php.net/manual/en/function.session-cache-expire.php
http://master.php.net/manage/user-notes.php?action=edit+26956
http://master.php.net/manage/user-notes.php?action=delete+26956
http://master.php.net/manage/user-notes.php?action=reject+26956