note 70924 added to ref.session

From: Date: Sat, 04 Nov 2006 05:45:55 +0000
Subject: note 70924 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-119365@lists.php.net to get a copy of this message
I discovered a new quirk with the use of session, php includes, and IE7. I have spent a lot of time tracking down a bug where my login session would start and work on the first page but then terminate requiring login again on any page clicked from an included menu. What I discovered is that the included menu links would actually create a whole new session with a new session id and my login security script was looking for the first session id. I found a way to fix this issue by doing a simple url inclusion of the original session id. Example: page1.php: <?php include_once("memberonly.php"); ?> <html> <head> </head> <body> <!-- html top part of page --> <? include_once("menu.php"); ?> <!-- more html --> </body> </html> menu.php: <a href="http://www.whatever.com/page2.php?sessid=<? session_id() ?>">page2</a> By passing the session id, session keeps the correct id on the clicked link. Apparently because this is an include on page 1, it acts as a whole new http request when one of the links on the included page is clicked. This same issue has also occurred in the firefox browser when I tested the site before the fix. Hopefully, for everyone using session for their login scripts and using page includes in the tabbed browsers, this will fix your issue. ---- Server IP: 66.163.161.117 Probable Submitter: 64.147.215.15 ---- Manual Page -- http://www.php.net/manual/en/ref.session.php Edit -- https://master.php.net/note/edit/70924 Del: integrated -- https://master.php.net/note/delete/70924/integrated Del: useless -- https://master.php.net/note/delete/70924/useless Del: bad code -- https://master.php.net/note/delete/70924/bad+code Del: spam -- https://master.php.net/note/delete/70924/spam Del: non-english -- https://master.php.net/note/delete/70924/non-english Del: in docs -- https://master.php.net/note/delete/70924/in+docs Del: other reasons-- https://master.php.net/note/delete/70924 Reject -- https://master.php.net/note/reject/70924 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119365) next »