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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.