note 80366 added to ref.session

From: Date: Sat, 12 Jan 2008 02:34:01 +0000
Subject: note 80366 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-135048@lists.php.net to get a copy of this message
I too ran into the problem of session data being different across the site when "www" was used and not used, so here's a proposed fix if you cannot easily change your "www" access for your web site. (Note: I used $HTTP_HOST rather than $_SERVER["HTTP_HOST"] and $PHP_SELF just for ease of reading) if($HTTP_HOST == "myhost.net") header('Location: http://www.myhost.net' . $PHP_SELF); you can also use: if($HTTP_HOST == "www.myhost.net") header('Location: http://myhost.net' . $PHP_SELF); Just throw that in a PHP file and include it at the top of all your PHP pages that are accessed. This way, before sessions are even used in a script, the access path is right. I think it should work out just fine. Hope it helps anyone with similar issues. ---- Server IP: 208.69.120.35 Probable Submitter: 24.27.66.32 ---- Manual Page -- http://www.php.net/manual/en/ref.session.php Edit -- https://master.php.net/note/edit/80366 Del: integrated -- https://master.php.net/note/delete/80366/integrated Del: useless -- https://master.php.net/note/delete/80366/useless Del: bad code -- https://master.php.net/note/delete/80366/bad+code Del: spam -- https://master.php.net/note/delete/80366/spam Del: non-english -- https://master.php.net/note/delete/80366/non-english Del: in docs -- https://master.php.net/note/delete/80366/in+docs Del: other reasons-- https://master.php.net/note/delete/80366 Reject -- https://master.php.net/note/reject/80366 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135048) next »