I'm having this problem with a site I'm working on. The weird thing is that it works fine in IE (6) but not in Firefox. Basically, when I log into the 'my account' section of the site (my own form/script) it doesn't seem to store the session variable the first time I do it (and consequently redirects me to my login page). When I type my stuff in again, it successfully goes to the account page just like it should have the first time.
I log out of the site, close my browser, and try the same thing in IE. It works the first time no problem. I repeat it multiple times and still the same issue.
I've written some debugging code, dumping the session variables, commenting out the redirect to the login page upon failure, etc, and it really just seems to be that the session isn't been set. Here's what my code looks like:
Login Page (posts to itself):
session_register('oi_loggedin_usr');
session_register('userID');
session_register('username');
$_SESSION['oi_loggedin_usr'] = 1;
$_SESSION['userID'] = $userID;
$_SESSION['username'] = $email;
echo "<script language='Javascript'>window.location='../account/'</script>";
And on the account page, very simply:
session_start();
header("Cache-control: private"); //IE 6 Fix
if (!$_SESSION['oi_loggedin_usr']) {
header("Location: ../login/");
}
Any thoughts? Thanks.
P.S. I know there are issues with this code in terms of unnecessary statements and shortcuts I could take, but I'll worry about those later. Just trying to work out this kink in the functioning of the site now.