note 70924 deleted from ref.session by betz

From: Date: Tue, 07 Nov 2006 12:06:27 +0000
Subject: note 70924 deleted from ref.session by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119465@lists.php.net to get a copy of this message
Note Submitter: cbm at cbmaspire dot com ---- 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.

« previous php.notes (#119465) next »