Forum Moderators: coopster

Message Too Old, No Replies

deleting cookies

deleting cookies not happening

         

mustdownloads

5:19 am on Jul 26, 2007 (gmt 0)

10+ Year Member



i am using

setcookie("siteuser", $username, time()+ 1209600);

cookies are created and work for two weeks

trying to delete it with

setcookie("siteuser", $username, time()- 1209600);

but not deleting

even tried

setcookie("siteuser", $username, time()- 1309600);

please help

Habtom

5:33 am on Jul 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can unset the $_cookie array.

Checkout this thread too: Cookies aren't deleting [webmasterworld.com]

mustdownloads

5:53 am on Jul 26, 2007 (gmt 0)

10+ Year Member



unset also not working

mustdownloads

5:56 am on Jul 26, 2007 (gmt 0)

10+ Year Member



i am using this

unset($_COOKIE['siteuser']);

Habtom

6:03 am on Jul 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This should work:

$_COOKIE = array();

Hab

mustdownloads

6:24 am on Jul 26, 2007 (gmt 0)

10+ Year Member



sorry tried not working

Habtom

12:21 pm on Jul 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are a few JS ways of deleting cookies. You need to search [google.com] webmasterworld threads to find a way to do those. You can start here [google.com]

You will surely find a way to do it, or find out the errors you are making by checking those threads.

If you can't delete them, you can always eat them. :)

jatar_k

1:40 pm on Jul 26, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



how are you testing whether it is deleted?

I believe you have to refresh or go to a new page to test properly since you are using setcookie

[php.net...]

check out the "common pitfalls"

joelgreen

1:49 pm on Jul 26, 2007 (gmt 0)

10+ Year Member



Sometimes cookie is hard to delete if no "domain" parameter specified.

WesleyC

2:04 pm on Jul 26, 2007 (gmt 0)

10+ Year Member



Also make sure that you aren't re-adding the cookie elsewhere in your script (I've run into that problem before).