thegooner

Hi

I 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 PHP $_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:

< php
session_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 on
6) Refresh the page (or click the link again) and all session data is lost - sent to unauthorised page

This 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.

It seems IE7 doesn't handle session data correctly.

Many many thanks for any help you can give



Re: Internet Explorer Web Development Sessions in IE7

thegooner

Anyone have any idea on this one



Re: Internet Explorer Web Development Sessions in IE7

arbor921

I'm having a similar problem with sessions. No problems in Firefox, Navigator, Opera, and as I remember it worked in IE 6 before Windows forced me to "upgrade". All I need to do to destroy a session it appears is to leave the page.

I'd also appreciate any information anyone has on this.

Thanks





Re: Internet Explorer Web Development Sessions in IE7

sebor

Anyone found a solution yet

Please let me know





Re: Internet Explorer Web Development Sessions in IE7

FSNHosting

I am having the exact same problem with IE 7. I've got a page that stores session values on each step to be inserted into a database at a later time, and I keep seeing IE 7 replacing the existing session value "username" with "iecssfix". No matter what I do, this happens. It's ONLY with IE 7, as FF, Opera, IE 6, and Netscape all work fine.

Help!!




Re: Internet Explorer Web Development Sessions in IE7

andm

It seems that this is an Problem that occurs with the way IE7 handles cookies.

To fix the problem I know two options:
  • The problem (only) occurs when javascript files are included in the HEAD section of the web page. Move them to the BODY and everything works fine. -> That solution fixed my problem

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=867126&SiteID=1
    (
    IE 7 display blank page on refresh when viewing session enabled PHP pages served from IIS 6!!)
  •  


Re: Internet Explorer Web Development Sessions in IE7

fredbecca

If I use the page

login1.php which uses the following

setcookie("login","xxx");

and then go to the page login.php which included this

$cookie=$_COOKIE['login'];

print "cookie=$cookie";

on the brower all I see is:

cookie=

why wasn't the cookie created What is wrong with IE 7.0





Re: Internet Explorer Web Development Sessions in IE7

EricLaw-MSFT

I am not aware of any IE Bugs in this area. If you can construct a minimal repro and either send me the URL or a log (see http://www.fiddlertool.com/fiddler/help/log.asp), and email it to me (ericlaw at microsoft) I'll take a look.

Thanks,

Eric Lawrence

Program Manager

IE Networking





Re: Internet Explorer Web Development Sessions in IE7

sebor

I had the problem that the session was lost after opening a new window. I have found the reason.

My home page was a html page located on my hard drive.

I've changed my home page to a url and all works fine.

This is a knwon issue http://support.microsoft.com/kb/300895





Re: Internet Explorer Web Development Sessions in IE7

Bod14

I have the same problem, ie that when a second window is closed, the session is lost. The problem is that the IE7 is deleting the cookies. A work around is not to use cookies to stor your session or of course use any other browser.