Jump to content

Can't delete cookies....


Ninjakreborn

Recommended Posts

<?php
session_start();
setcookie("user_id", "", time()-3600, "/", "www.mystagingsite1.net");
setcookie("territory", "", time()-3600, "/", "www.mystagingsite1.net");
setcookie("membership_level", "", time()-3600, "/", "www.mystagingsite1.net");
session_destroy();
header("Location: gateway.php");
?>

 

I am setting them using set cookie like:

<?php
	setcookie("user_id", $row['user_id'], time()+3600, "/", "www.mystagingsite1.net");
	setcookie("territory", $row['territory'], time()+3600, "/", "www.mystagingsite1.net");
	setcookie("membership_level", $row['membership_level'], time()+3600, "/", "www.mystagingsite1.net");
?>

 

This is not deleting cookies.  It should be.  If I do this and it redirects me then I revisit the homepage, I am still logged in even after doing this. I have tried doing this in about 20 different ways and these stupid sessions won't die. I even tried unsetting them manually as well, nothing is working.

Advice?

Link to comment
Share on other sites

this could be nothing, but your it looks like your setting cookies in the future : )

will this work?

setcookie("user_id", "", time()-5000, "/", "www.mystagingsite1.net");
setcookie("territory", "", time()-5000, "/", "www.mystagingsite1.net");
setcookie("membership_level", "", time()-5000, "/", "www.mystagingsite1.net");

 

Link to comment
Share on other sites

Pardon my ignorance here but:-

<?php
session_start();
setcookie("user_id", "", "0", "/", "www.mystagingsite1.net");
setcookie("territory", "", "0", "/", "www.mystagingsite1.net");
setcookie("membership_level", "", "0", "/", "www.mystagingsite1.net");

unset($_COOKIE);
unset($_SESSION);

session_destroy();
header("Location: gateway.php");
?>

 

Wouldn't that be a more pragmatic approach to killing off cookies?

 

Cheers,

Rw

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.