RE: [PHP] header() ???
| From: | Jason Murray | Date: | Thu, 14 Sep 2000 05:49:39 +0000 |
| Subject: | RE: [PHP] header() ??? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16698@lists.php.net to get a copy of this message | ||
> 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