note 11422 deleted from function.setcookie by victor

From: Date: Tue, 31 Dec 2002 14:58:20 +0000
Subject: note 11422 deleted from function.setcookie by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41515@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)

« previous php.notes (#41515) next »