Page 1 of 1

I can't expire a cookie

Posted: Sun Sep 09, 2007 1:16 am
by luna80
Hi,
I have a problem with the setcookie function: I don't know why but the cookie doesn't expire.

I create the cookie with

Code: Select all

setcookie('cookie_name', $userid, time()+7776000);
and I try to expire it with

Code: Select all

setcookie('cookie_name', '', time()-7200);
but doesn't work.
If I check the expiration date of my cookie in the options of my browser and I see that the date is the same before and after calling setcookie with a past time...

Somebody can explain me why?

Thanks in advance

Posted: Sun Sep 09, 2007 8:01 am
by feyd
Are these done in separate files?

Posted: Sun Sep 09, 2007 9:46 am
by luna80
feyd wrote:Are these done in separate files?
yes...the first is done in the login page and the second in the logout page.

do you know the problem?

thanks

Posted: Sun Sep 09, 2007 4:52 pm
by feyd
Where (physically) is the login page relative to the logout page?

Posted: Mon Sep 10, 2007 1:34 am
by luna80
feyd wrote:Where (physically) is the login page relative to the logout page?
in the same place (same folder, if is that do you mean)