note 11422 modified in setcookie by jmcastagnetto

From: Date: Wed, 21 Feb 2001 04:09:20 +0000
Subject: note 11422 modified in setcookie by jmcastagnetto
Groups: php.notes 
Request: Send a blank email to php-notes+get-11325@lists.php.net to get a copy of this message
[Editor's note: It is not the problem w/ the header() or setcookie() functions, it is your logic that 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.e. sending a header and setting a cookie] 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/setcookie.php

« previous php.notes (#11325) next »