Jump to content

Recommended Posts

Im having issues with IE 6 only - everything works fine in IE7 and Firefox (typical :P) - also im new to PHP programming, so i may be omitting something. But searching thru the net, including these forums, i have found a fair few posts about this kind of issue, but none of the suggested solutions seem to work.

 

anyway heres my code.

session_start();
if($_POST['username'] && $_POST['password'] ) {
    if($_POST['username'] == "correct" && $_POST['password'] == "correct"){
        $_SESSION[username] = "correct";
        $_SESSION[password] = "correct";
    }
}
if($_SESSION[username] == "correct" && $_SESSION[password] == "correct"){
    $loggedIn = 1;
}  

what happens is in IE6, if im on the login page, if i enter correct username and pass, then submit the form, the page reloads and updates correctly to reflect the successful login. but then as soon as i navigate to another page i get magically logged out again.

 

btw - the code i posted above is contained in the first lines of a setup.php file which is included in all pages in the site (actually the site is just one index.php page that recieves GET variable to indicate what page to display) - does this affect anything?

Link to comment
https://forums.phpfreaks.com/topic/51601-ie6-_session-variables-dissappearing/
Share on other sites

Does your hostname happen to have an underscore '_' in it? There is a known issue with IE6 freaking out when the hostname has an underscore, but that's the only reason I can think of for only IE6 to have a problem with the cookies.. An underscore in the hostname isn't really valid anyhow, but most browsers can deal with it and still work fine..

 

One other thing you could try is to add a session_write_close(); after you are finished setting your session variables.. This should guarantee that the session vars have been saved..

 

Best of luck!

 

Definitely strange, I can't remember having any major problems with IE6 and keeping a session going.. Maybe it's just a problem with your IE, can you try it on another machine? If not, try clearing the cache and deleting the cookies (or at least the one cookie for the site your working on).

 

thanks dude good call - it turns out it works fine on other machines - i reckon i know why too - on my testing machine im using IE 7 as my proper IE, but also have "ie6_eolas_nt", a v6 version running as well so i can test sites CSS for the constant spate of IE6 display errors...im assuming my IE 6 install doesnt handle cookies and sessions so well seeing as its not the proper IE install...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.