note 68419 added to function.header
| From: | devonmitton at gmail dot com | Date: | Wed, 26 Jul 2006 08:38:09 +0000 |
| Subject: | note 68419 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115204@lists.php.net to get a copy of this message | ||
I ran into the problem of losing the session after i redirect the user with header( location:);
I found that the problem doesn't occur in php5. Atleast for myself. I tested it on IIS as well
as Apache and both times using php5 fixed the issue.
Secondly, I found a weird solution: The website i'm building required Cyrillic type, so i
encode the pages using UTF-8. The problem that happens is that UTF-8 sends information before the
php tags, and therefore before the session_start(); which ultimately renders the session_start();
call ineffective.
The UTF-8 encoding sends a small chunk of information before anything. This is called BOM (byte
order marks).
To ensure that they don't show up, you need to save your files with a UTF-8 encoding which
bypasses BOM. BBEdit for the Macintosh with allow for this under the file encoding options.
To recap: In this instance and for my situation, UTF-8, no BOM will allow sessions to pass through
the header( location:); redirect, or using PHP5.
Hope this helps someone! [i will also repeat this comment under the session_start() function]
----
Server IP: 66.163.161.117
Probable Submitter: 24.76.127.146
----
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.header.php
Edit -- http://master.php.net/note/edit/68419
Del: integrated -- http://master.php.net/note/delete/68419/integrated
Del: useless -- http://master.php.net/note/delete/68419/useless
Del: bad code -- http://master.php.net/note/delete/68419/bad+code
Del: spam -- http://master.php.net/note/delete/68419/spam
Del: non-english -- http://master.php.net/note/delete/68419/non-english
Del: in docs -- http://master.php.net/note/delete/68419/in+docs
Del: other reasons-- http://master.php.net/note/delete/68419
Reject -- http://master.php.net/note/reject/68419
Search -- http://master.php.net/manage/user-notes.php