Jump to content

unsetting cookies.


xyn

Recommended Posts

Hi.

I've not used cookies much, but I started to try and use them,

I understand to unset them the expirey date /time needs to be

in the past. i've used...

 

<?
$cookie_name = "testCookie";
if(!$_COOKIE[$cookie_name]){
setcookie($cookie_name, "true", time()+(14*24*60*60)); # 2 weeks.
echo("setting");
}
else{
if($_GET[x] == 1){
setcookie($cookie_name, "true", time()-(14*24*60*60)); # 2 weeks Ago.
}
print_r($_COOKIE);
}
?>

 

it doesnt seem to expire the cookie.

Link to comment
https://forums.phpfreaks.com/topic/72289-unsetting-cookies/
Share on other sites

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.