note 63970 added to function.session-write-close
| From: | risaacatdeadletterdotcom at osu1 dot php dot net | Date: | Tue, 04 Apr 2006 19:46:12 +0000 |
| Subject: | note 63970 added to function.session-write-close | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107334@lists.php.net to get a copy of this message | ||
Workaround if session_write_close() still doesn't write sessions fast enough:
I found with one PHP login system that even session_write_close() was not setting the session
variables before I transferred pages with a Location: header. So the user would log in, I would
create the $_SESSION variables, call session_write_close() and then transfer to the secure page
using header(Location:...). The secure page would check for the session vars, not find them, and
force the user to log in again. After the second login the session would be found and they could
continue.
My workaround was to create the $_SESSION variables with 0 values before writing the initial login
page. Then I updated the session vars with the login results and used the header() function to
switch to the secure location. Once the session vars have already been created, updated values are
assigned quickly. Problem solved. Just be sure the secure page checks both that the $_SESSION var
exists AND that it's not 0.
----
Server IP: 64.71.164.2
Probable Submitter: 72.1.149.198
----
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-write-close.php
Edit -- http://master.php.net/note/edit/63970
Del: integrated -- http://master.php.net/note/delete/63970/integrated
Del: useless -- http://master.php.net/note/delete/63970/useless
Del: bad code -- http://master.php.net/note/delete/63970/bad+code
Del: spam -- http://master.php.net/note/delete/63970/spam
Del: non-english -- http://master.php.net/note/delete/63970/non-english
Del: in docs -- http://master.php.net/note/delete/63970/in+docs
Del: other reasons-- http://master.php.net/note/delete/63970
Reject -- http://master.php.net/note/reject/63970
Search -- http://master.php.net/manage/user-notes.php