note 26424 added to ref.session

From: Date: Wed, 30 Oct 2002 14:00:21 +0000
Subject: note 26424 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-38749@lists.php.net to get a copy of this message
Just to prevent you from falling into a pit when working with sessions and cookies. In contrast to setcookie() the session.cookie_lifetime expects an integer which is added automaticaly to the current time(). So don't set session.cookie_lifetime to something like time()+int or your session cookie will life a very long time ;-))). If you want to expire your session at the same date when your cookies expire try something like: ---------------------------------------------------------- $session_expire = 86400; $cookie_expire = time()+$session_expire; ini_set("session.cookie_lifetime",$session_expire); session_start(); setcookie("cookie", "content", $cookie_expire, "/"); ---------------------------------------------------------- Have a nice day ... -- http://www.php.net/manual/en/ref.session.php http://master.php.net/manage/user-notes.php?action=edit+26424 http://master.php.net/manage/user-notes.php?action=delete+26424 http://master.php.net/manage/user-notes.php?action=reject+26424

« previous php.notes (#38749) next »