matthewjumpsoffbuildings Posted May 16, 2007 Share Posted May 16, 2007 Im having issues with IE 6 only - everything works fine in IE7 and Firefox (typical ) - 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? Quote Link to comment https://forums.phpfreaks.com/topic/51601-ie6-_session-variables-dissappearing/ Share on other sites More sharing options...
phast1 Posted May 16, 2007 Share Posted May 16, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/51601-ie6-_session-variables-dissappearing/#findComment-254163 Share on other sites More sharing options...
matthewjumpsoffbuildings Posted May 16, 2007 Author Share Posted May 16, 2007 i actually tried session_write_close() - and no hostname doesnt ahve an underscore in it... ill give session_write_close() another shot... Quote Link to comment https://forums.phpfreaks.com/topic/51601-ie6-_session-variables-dissappearing/#findComment-254167 Share on other sites More sharing options...
matthewjumpsoffbuildings Posted May 16, 2007 Author Share Posted May 16, 2007 nope still no love Quote Link to comment https://forums.phpfreaks.com/topic/51601-ie6-_session-variables-dissappearing/#findComment-254238 Share on other sites More sharing options...
phast1 Posted May 16, 2007 Share Posted May 16, 2007 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). Quote Link to comment https://forums.phpfreaks.com/topic/51601-ie6-_session-variables-dissappearing/#findComment-254256 Share on other sites More sharing options...
matthewjumpsoffbuildings Posted May 16, 2007 Author Share Posted May 16, 2007 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... Quote Link to comment https://forums.phpfreaks.com/topic/51601-ie6-_session-variables-dissappearing/#findComment-254273 Share on other sites More sharing options...
phast1 Posted May 17, 2007 Share Posted May 17, 2007 Ah, yeah, must have been a bug in the custom IE6 or a conflict between the two versions.. Glad to hear that its figured out now Quote Link to comment https://forums.phpfreaks.com/topic/51601-ie6-_session-variables-dissappearing/#findComment-255659 Share on other sites More sharing options...
matthewjumpsoffbuildings Posted May 21, 2007 Author Share Posted May 21, 2007 cheers thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/51601-ie6-_session-variables-dissappearing/#findComment-258231 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.