note 12564 deleted from function.header by jimw
| From: | jimw@php.net | Date: | Wed, 31 Oct 2001 21:58:26 +0000 |
| Subject: | note 12564 deleted from function.header by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19775@lists.php.net to get a copy of this message | ||
It appears that header() functions are always executed no matter what conditions surround it.
i.e.
<?php
if($var)
header("Location: http://php.net");?>
header is executed no matter the value of $var
I encountered this when I was creating my site template and had an condition , if the page was
restricted and no user was loged in, then redirect to the login page. to fix I had to
<?php
if($var)
include "redirct.inc";?>
and of coarse redirct.inc contains
<?php
header("Location: http://php.net");?>
and if works as intended