Gooner Posted November 15, 2006 Share Posted November 15, 2006 HiI am pulling my hair out over this problem, and am getting to the stage where I'm gonna scream.All these pages work perfectly on IE6, Firefox, Netscape etc, but I have come across a problem when testing them on IE7.Here's the problem:I have a web based system where a user logs into the site. Upon signing in, a number of $_SESSION variables get populated with data, so that the subsequent pages know that he is allowed to visit them, and who he is.One of these variables is:$_SESSION['username']At the top of all subsequent pages, the php script reads:<?phpsession_start();if (!isset($_SESSION['username'])) { header("Location:unauthorised.php"); exit;}?>This effectively checks to see if the user is logged in, and if not, sends them to the "unauthorised" page.This check works fine.However, on one of these subsequent pages, I have a link that opens a new window with some information, using the standard <a tag. This is the link :<a href="new_page.php" target="_blank">Click here</a>Now, this "new_page.php" also has the script that checks to see if the user logs in.This new page is displayed fine.HOWEVER, and this is my problem........When I close this new window (using IE7 - it works fine in other browsers), and am left with the original page with the link on it, my session data seems to disappear. If I click on refresh, I'm taken to my "unauthorised" page.WHY IS THIS HAPPENING IN IE7 ??????So, to recap.........1) User logs in and session variable stores $_SESSION['username']2) User goes to new page (page checks to see if logged in - which he is)3) User click on link on this page which opens new window (using target="_blank").4) This new window displays fine (page checks to see if logged in - which he is)5) Close this new window, leaving the original page with the link on6) Refresh the page (or click the link again) and all session data is lost - sent to unauthorised pageThis is only a problem in IE7.Can someone please suggest a workaround for this issue. I'm almost positive it's a IE7 fault, but am amazed that there aren't loads of people with this issue posting on forums.Many many thanks for any help you can give Link to comment https://forums.phpfreaks.com/topic/27338-php-sessions-please-help/ Share on other sites More sharing options...
Gooner Posted November 16, 2006 Author Share Posted November 16, 2006 Anyone got any clues on this one? :( Link to comment https://forums.phpfreaks.com/topic/27338-php-sessions-please-help/#findComment-125466 Share on other sites More sharing options...
fiddy Posted November 16, 2006 Share Posted November 16, 2006 I guess its becuse session gets expiered when the window is closed. can you use cookies.. Link to comment https://forums.phpfreaks.com/topic/27338-php-sessions-please-help/#findComment-125499 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.