Re: note 11422 added to setcookie
| From: | Jesus M. Castagnetto | Date: | Wed, 21 Feb 2001 04:10:33 +0000 |
| Subject: | Re: note 11422 added to setcookie | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-11326@lists.php.net to get a copy of this message | ||
Ehem, your logic is not correct, you should use a
construct like:
if (condition) {
header(...);
// do some cleanup if needed
exit;
}
if you want to shortcircuit the execution, otherwise,
the script is doing exactly what you are asking it to
do.
I will add the comment above to your note, if you want
me to remove your note instead, let me know soon.
--- PJ@piggei.com wrote:
> WARNING!
>
> In a code like this:
>
> -------
> if (condition)
> header("Location: s_pw.php");
>
> setcookie ("name", "true", time() + 3600);
> -------
>
> the coockie is *always* sent!
> (the location is an header and doesn't work like a
> goto)
>
> http://www.php.net/manual/en/function.setcookie.php
>
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-notes-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-notes-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
--- Jesus M. Castagnetto <jmcastagnetto@php.net>
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/