RE: Changing the Action attribute of Form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, November 1, 2006 10:09 am, Edward Kay wrote:
>   $redirect_url = 'http://www.example.com/path/to/' . $redirect_page;
>   header('Location:'.$redirect_url);
>   exit();

Rant #43

I will never understand why one would waste bandwidth and bounce the
server/user/browser/user/browser/server back and for with a
header("Location: $x"); when require $x; will work just as well...

I just don't get it.

You chew up HTTP connections and bandwidth and end back up in the
exact same spot as if you just include() the file, if your application
is well-constructed.

Plus, cookies (and hence cookie-based sessions) and Location: headers
tend not to play well with each other, unless you strew your code with
sesssion_write_close() before each header("Location: ")...  This
starts to get real counter-intuitive and difficult to track, at least
for my tired old brain.

:-)

PS
In either case, be careful *NOT* to have a wide-open variable in the
destination/include path.
Avoid this scenario:
http://example.com/page=../../../../../../../../etc/passwd
leading to:
<?php require $page; ?>

[lawyer voice-over]
(data left un-urlencoded for demo purposes)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux