note 96868 added to function.session-set-cookie-params
| From: | jan at dewal dot net | Date: | Fri, 19 Mar 2010 22:42:59 +0000 |
| Subject: | note 96868 added to function.session-set-cookie-params | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167237@lists.php.net to get a copy of this message | ||
The information above about this function that it can only be used BEFORE session_start depends on
how you use it. Because its also useful AFTER a session has started as follows:
Example you wand to change an already set value of the session cookie expire time:
<?php
// Here we start as usual
session_set_cookie_params('3600'); // 1 hour
session_start();
// More code...
// Now we found in some database that the user whishes
// the cookie to expire after for example 10 minutes
// we can change it instantly !
session_set_cookie_params('600'); // 10 minutes.
session_regenerate_id(true);
// This will delete old cookie and adopt new expire settings and the
// old cookie variables in a new cookie
?>
Please note i only explained the browser (client) side changes of session cookie's expire time.
----
Server IP: 69.147.83.197
Probable Submitter: 213.46.14.116
----
Manual Page -- http://www.php.net/manual/en/function.session-set-cookie-params.php
Edit -- https://master.php.net/note/edit/96868
Del: integrated -- https://master.php.net/note/delete/96868/integrated
Del: useless -- https://master.php.net/note/delete/96868/useless
Del: bad code -- https://master.php.net/note/delete/96868/bad+code
Del: spam -- https://master.php.net/note/delete/96868/spam
Del: non-english -- https://master.php.net/note/delete/96868/non-english
Del: in docs -- https://master.php.net/note/delete/96868/in+docs
Del: other reasons-- https://master.php.net/note/delete/96868
Reject -- https://master.php.net/note/reject/96868
Search -- https://master.php.net/manage/user-notes.php