RE: [PHP] header() ???
| From: | Sonia Tsui | Date: | Thu, 14 Sep 2000 04:49:37 +0000 |
| Subject: | RE: [PHP] header() ??? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16699@lists.php.net to get a copy of this message | ||
Jason,
I see. So even if the content of the other page resides on the same server
of the current page, is it still better to use header()?
thanks
---Sonia
-----Original Message-----
From: Jason Murray [mailto:Jason.Murray@melbourneit.com.au]
Sent: Wednesday, September 13, 2000 10:50 PM
To: 'Sonia Tsui'
Cc: 'php-general@lists.php.net'
Subject: RE: [PHP] header() ???
> I checked the book "Professional PHP Programming" and
> refer to how they use header():
>
> if (!authenticateUser($cookie_user, $cookie_passwd)) {
>
> header("Location:http://$HTTP_HOST/$DOCROOT/default.htm");
> exit();
> }
>
> what difference does that make if I do this instead:
> if (...) {
> include "http://$HTTP_HOST/$DCROOT/default.htm");
> exit();
> }
>
> I guess my question is really this: header is used here to
> redirect user to other pages, but is it equivalent of doing this
> using include in this case?
If you include it, you are presenting the contents of the other page as
the current page.
If you redirect to it, you are sending the browser to a different page.
IMHO you should never include() from http:// anyway, since the remote server
may be down or timed out.
Jason