Re: Re: [PHP3] deleting cookies.
| From: | Andy Warwick | Date: | Wed, 14 Jun 2000 23:57:34 +0000 |
| Subject: | Re: Re: [PHP3] deleting cookies. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1891@lists.php.net to get a copy of this message | ||
on 14/6/00 11:53 pm, Zak Greant at zak@nucleus.com wrote:
> Hello Nicholas,
>
> You are deleting the cookies properly. The problem is that setting a
> Location header interferes with setting or deleting cookies. Try using an
> alternate to location like the Redirect header.
Further to Zak's message, thought you might find this reference useful, as
might a few other people having similar troubles with cookies and redirects.
Firstly I assume you are all running IIS; this bug is thanks to Bill and his
cronies, not PHP. Had me fooled for hours, as I couldn't figure out code
that worked on Linux failed under IIS. (Don't ask why I had to move it; long
story...)
The reference was found on php.net, in the annotated manual, under cookies
(I think).
I quote:
> "There are several references to a bug when header("Location:") is used in
> conjunction with setcookie. Several comments talk about this happening in IE4.
>
> It's not an IE4 bug, it's an IIS bug. The bug also appears to exist in IIS 5
> (Windows 2000). The bug is documented in KB article Q176113.
>
>
> http://support.microsoft.com/support/kb/articles/q176/1/13.asp
I tried what the tech note said and still couldn't get it to work, so ended
up using the META tag redirect method.
ie. setcookie("foo", $time, $expire);
echo ("<META http-equiv=\"Refresh\"
content=\"0;URL=bar.htm\">");
instead of:
setcookie("foo", $time, $expire);
header ("Location: bar.htm");
It would be nice to think that if MS know enough about it to write a tech
note, they could try
to get around to fixing it. Gotta love how it says its a bug in 3 versions
of IIS.
HTH
Regards
Andy Warwick
>>> Nicholas Burke wrote:
>>>
>>> This isn't very complex but its pissing me off.
>>>
>>> setcookie("current_client");
>>> setcookie("current_order");
>>>
>>> header("Location: /admin/admin.php");
>>>
>>> trying to delete current_client and current order cookies and then
>>> redirecting back to the main page. In the php manual it says all you need
>>> to do to delete cookies is call setcookie with only the name argument.
>>> Simple enough i thought... but low and behold its just can't be that easy.
>>> It never erases the cookie and i'm back to square one, if anyone has any
>>> ideas, or knows something i'm completely missing i'd love to hear it.
>>> Thanks.
>>>
>>> Nicholas Burke
>>> Purplemedia,