note 75206 added to function.header

From: Date: Thu, 17 May 2007 18:58:22 +0000
Subject: note 75206 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-126674@lists.php.net to get a copy of this message
When not using "exit;" after the header("Location: ..."), the execution of the script continue below the header, until the end is reached. After this, it's doing the "Redirect". if($error) { header("Location: http://url.com"); } //the script continue with or without an error and execute some function that we do not want... delete($file); It could be important to put exit always after a Redirect. if($error) { header("Location: http://url.com"); exit; } //the script continue only without error. It will execute what we want to do. ---- Server IP: 66.207.199.35 Probable Submitter: 64.235.222.34 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- https://master.php.net/note/edit/75206 Del: integrated -- https://master.php.net/note/delete/75206/integrated Del: useless -- https://master.php.net/note/delete/75206/useless Del: bad code -- https://master.php.net/note/delete/75206/bad+code Del: spam -- https://master.php.net/note/delete/75206/spam Del: non-english -- https://master.php.net/note/delete/75206/non-english Del: in docs -- https://master.php.net/note/delete/75206/in+docs Del: other reasons-- https://master.php.net/note/delete/75206 Reject -- https://master.php.net/note/reject/75206 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#126674) next »