Re: In need of a script
| From: | Jason Sheets | Date: | Mon, 25 Aug 2003 14:23:53 +0000 |
| Subject: | Re: In need of a script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160663@lists.php.net to get a copy of this message | ||
One thing to be aware of, Location: /newpage.php will probably work with most browsers (I know it works with IE, Mozilla and Opera) but the spec requires an absolute path to the file you are redirecting to including protocol, server, path and file. As Wouter demonstrated you should always die() after a redirect request because it is just that, a request that the client is not required to follow.
Jason
Wouter van Vliet wrote:
Though no parse error, it can result in an notice about 'undefined index' .. I'd prefer <?php if (isset($_COOKIE['pagename'])) { header('Location: /newpage.php'); die; }; ?> Taking care of three things: - No undifined index notice - the cookie can also have a value that evaluates to false - the 'die;' makes sure the script really ends .. sometimes, somehow for some undefined reason it does not stop after a header.. Wouter -> -----Oorspronkelijk bericht----- -> Van: Curt Zirzow [mailto:php-general@zirzow.dyndns.org] -> Verzonden: zondag 24 augustus 2003 20:22 -> Aan: php-general@lists.php.net -> Onderwerp: Re: [PHP] In need of a script -> -> -> * Thus wrote Stevie D Peele (sdp2006@juno.com): -> > Heres what I wrote -- -> > -> > <?php -> > if ($_COOKIE['pagename']) -> > { -> > header('Location: http://www.net-riches.com/800x600.html'); -> > } -> > ?> -> > -> > and I got a parse error on line 4, but I do not see what is -> wrong on line -> > 4! -> -> There is no parse error in that code. -> -> Curt -> -- -> "I used to think I was indecisive, but now I'm not so sure." -> -> -- -> PHP General Mailing List (http://www.php.net/) -> To unsubscribe, visit: http://www.php.net/unsub.php