Page 1 of 1

PHP sessions

Posted: Tue Nov 07, 2006 10:12 am
by Gooner
Hi

I am having some trouble with sessions using PHP, ever since upgrading to IE7. Can you help?

The below used to work with IE6, but now the user's session data seems to get lost. Here's the pages:

A user logs into the site.

He then goes to a page that when it is called, a new page is loaded as a pop-up (using Javascript). here's the code :

Code: Select all

<script language="JavaScript" type="text/JavaScript">
<!--
  window.open('temp/tmp<?php echo $rr; ?>.pdf','','');
//-->
</script>
Now, this popup opens fine; the session data is carried through to it. It opens in a separate window, not as a new tab in IE7.

If I then close this pop-up window, whenever I resfresh/move away from the original page that produced the popup, my session data is lost and the user has to log in again.

So, to recap >>

User logs in
User goes to page that produces a popup.
This page stays open in original window , whereas popup is displyed in a new browser window.
Popup is closed
Session data now lost in original window.

I have session_start(); at the top of all pages concerned.

It used to work fine in IE6 and all other browsers, but not in IE7. I think it may have something to do with the new IE7 tabbed browsing, but I don't know.

Anyone got any clues on this one, as I'm completely stumped.

**edit**

If I leave the popup window open, the session data is HELD by the original page (until I close the popup).

Thanks a lot

Posted: Tue Nov 07, 2006 11:47 am
by Christopher
There could be a couple of things going on. There are cases where you manually need to add the session id to your URL to make sure that it is passed through. Also with multiple windows open or when redirecting, you often need to use session_write_close() to make sure that the session data is written before another script reads the session data. Not sure either of these are the solution though.