note 63246 deleted from function.session-start by nlopess
| From: | nlopess@php.net | Date: | Fri, 17 Mar 2006 09:54:19 +0000 |
| Subject: | note 63246 deleted from function.session-start by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-105971@lists.php.net to get a copy of this message | ||
Note Submitter: fifthnormal at hotmail dot com
----
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