note 63246 added to function.session-start
| From: | fifthnormalathotmaildotcom at osu1 dot php dot net | Date: | Fri, 17 Mar 2006 01:27:29 +0000 |
| Subject: | note 63246 added to function.session-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-105961@lists.php.net to get a copy of this message | ||
Hello,
I have had bad results with calling session_write_close() only at the end of a script right before
redirecting. Especially when saving objects to the session.
Instead, call session_write_close() after each session variable is set if you want to ensure that
the session data is saved correctly. This has been the solution to the problem for me.
For instance:
$_SESSION['user'] = $user;
session_write_close();
$_SESSION['role'] = $role;
session_write_close();
header("location: main_itsp.php");
exit();
Thanks,
Daniel
----
Server IP: 66.163.161.117
Probable Submitter: 24.1.136.7
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.session-start.php
Edit -- http://master.php.net/note/edit/63246
Del: integrated -- http://master.php.net/note/delete/63246/integrated
Del: useless -- http://master.php.net/note/delete/63246/useless
Del: bad code -- http://master.php.net/note/delete/63246/bad+code
Del: spam -- http://master.php.net/note/delete/63246/spam
Del: non-english -- http://master.php.net/note/delete/63246/non-english
Del: in docs -- http://master.php.net/note/delete/63246/in+docs
Del: other reasons-- http://master.php.net/note/delete/63246
Reject -- http://master.php.net/note/reject/63246
Search -- http://master.php.net/manage/user-notes.php