Jump to content

Cookie sometimes not saved in Internet Explorer


Jason28

Recommended Posts

Hello, I do not understand if it is just my PC acting weird or perhaps a bad way I coded a script.  I used cookies as logins by following different tutorials and everything works perfectly.  However every now and then for some reason it is like the cookies are not being stored on my PC when I try to login.  The page just refreshes itself with no errors or anything and when I check my cookie folder there is nothing there.  However I can login with FireFox just fine and a week or so later Internet Explorer will begin working again.  Any ideas?  If it is just my computer I am not too worried about it but if it is not then I do not want to have my members complain about it.  Thanks!

I have set the cookie for 7200 (I recently changed it from 3600 hoping it would solve the problem).  I didn't post the code since I have other files such as the config and other includes so the cookie code may not make much sense but here it goes anyway :)  I basically wrote it this way in case I ever wanted to change a cookie name I can and it also checks to make sure someone doesn't cheat by editing their cookie file by checking that all of the cookie values match those found in the DB.  Here is part of the code for the login page:

 

if ( clean_var($_POST["login"]) && $error != TRUE ) 
	{
		$md5_pass = md5($pass . SALT);
		setcookie($ck_admin_user, $user, time() + $cookie_expire_time);
		setcookie($ck_admin_pass, $md5_pass, time() + $cookie_expire_time);
		setcookie($ck_admin_level, $row['level'], time() + $cookie_expire_time);


		header("Location: ".$site_url."admin/admin.php");
		exit;
	}

 

Basically just using the setcookie function.  It always works in Firefox but sometimes it doesn't work in IE.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.