views:

29

answers:

2

Hi,

I can't find a good answer for this anywhere. I have a login page, and after a good login it redirects to main page. In FF, and chrome - works perfect. On IE it doesn't work. I keep losing the session when I get to the main page.

I have checked the following: - session_start at top - no blanks or anything befoer header redirect - one line before the redirect, IE knows the session user id, but after the redirect, just one line after the session start, it loses the session user id - I've checked it also on other computer - same results

What is wrong with IE? or what could be wrong with my script ? Thanks

A: 
  • Set PHP's error_reporting to -1; reproduce error; check logs
  • Check IE's privacy settings--$_SESSION relies on either a cookie or URL-based session identifier. It seems as though it's having trouble saving the cookie
  • Is there anything you're doing to the response that is not standard (eg modifying headers)
  • Can you build an extremely simple version of this code and test it using nothing but the bare essentials (narrow down the problem to a specific bit of code)

[Edit]

  • Make sure you aren't calling session_start() twice ;)
Tim
Hi Tim,Thanks for your answer, but I have managed to fix it...
OfficeJet
Great! To avoid future problems like this, I suggest getting _very_ intimate with your error log. I am almost positive PHP warns you about this type of stuff.
Tim
A: 

Ok,

Problem solved. I can't find the logic behind this solution, but although I had session_start() at the top of the page, I added another session_start() just before writing the session vars.

OfficeJet