Destroy cookie problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hame22
Forum Contributor
Posts: 214
Joined: Wed May 11, 2005 5:50 am

Destroy cookie problem

Post by hame22 »

Hi Guys,

I have a login facility on my site that includes a "remember me" facility that remembers a users username and password, these details are stored in cookies:

Code: Select all

if ($check)
			{
				$time = time();
				setcookie("fenmanactivities[username]", $username, $time + 3600);
				setcookie("fenmanactivities[password]", $password, $time + 3600);
			}
when a user logouts of the site I want to destroy this cookie and i have used the following code to destroy the username

Code: Select all

if (isset($_COOKIE['fenmanactivities']))
{
	
	$time = time();
	setcookie("fenmanactivities[username]", $_SESSION['valid_user'] , $time - 3600);
	//setcookie("fenmanactivities[password]","" , $time - 3600);
	
	
}

Now this script works fine in IE but does not work at all in firefox!

does anyone have any ideas as to why this happens and any solutions to my sript?

thanks in advanced
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

setcookie('fenmanactivities[username]','',time()-3600*24*30);
remember that the cookie must match the path, domain, and security setting that was sent with the previous cookie.
Post Reply