Re: [PHP] In need of a script
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:[EMAIL PROTECTED] - Verzonden: zondag 24 augustus 2003 20:22 - Aan: [EMAIL PROTECTED] - Onderwerp: Re: [PHP] In need of a script - - - * Thus wrote Stevie D Peele ([EMAIL PROTECTED]): - 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] In need of a script
Can someone show me an example of some code that works something like this : ?php if cookie is present redirect to a certain page ? Thanks The best thing to hit the internet in years - Juno SpeedBand! Surf the web up to FIVE TIMES FASTER! Only $14.95/ month - visit www.juno.com to sign up today! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] In need of a script
On Sunday, August 24, 2003 at 9:49 AM Stevie D Peele wrote: Can someone show me an example of some code that works something like this : ?php if cookie is present redirect to a certain page ? ?php // this must be the first line in the script (or use output buffering) -- see http://www.php.net/header for explanation if ($_COOKIE['cookie_I_want_to_know_about']) { header('Location: http://www.someserver.com/page.php'); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] In need of a script
it's in the manual. Stevie D Peele wrote: Can someone show me an example of some code that works something like this : ?php if cookie is present redirect to a certain page ? Thanks The best thing to hit the internet in years - Juno SpeedBand! Surf the web up to FIVE TIMES FASTER! Only $14.95/ month - visit www.juno.com to sign up today! -- http://www.raditha.com/php/progress.php A progress bar for PHP file uploads. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] In need of a script
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! Can anyone else see? Thanks On Sun, 24 Aug 2003 10:04:50 -0400 Matt [EMAIL PROTECTED] writes: On Sunday, August 24, 2003 at 9:49 AM Stevie D Peele wrote: Can someone show me an example of some code that works something like this : ?php if cookie is present redirect to a certain page ? ?php // this must be the first line in the script (or use output buffering) -- see http://www.php.net/header for explanation if ($_COOKIE['cookie_I_want_to_know_about']) { header('Location: http://www.someserver.com/page.php'); ?
Re: [PHP] In need of a script
* Thus wrote Stevie D Peele ([EMAIL PROTECTED]): 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
RE: [PHP] In need of a script
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:[EMAIL PROTECTED] - Verzonden: zondag 24 augustus 2003 20:22 - Aan: [EMAIL PROTECTED] - Onderwerp: Re: [PHP] In need of a script - - - * Thus wrote Stevie D Peele ([EMAIL PROTECTED]): - 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php