At 07:02 02.03.2003, Sunfire said:
--------------------[snip]--------------------
>basic question about www-authenticate header...(least i hop its simple)
>i have the code:
><?php
>header("WWW-Authenticate: basic realm='a realm'");
>header("HTTP/1.0 402 Unauthorized");//dont understand
>//what this line does
>echo "you didnt login yet\n"; //understand it but want
>//something else like a header sent out...
>dont understand what the second line is for and was wondering if that third
>line that someone gets when you hit cancel can be turned into another
>header? or is there a way to force a header block even if output has already
>been put on the screen?
--------------------[snip]--------------------
To understand the header lines you need to have some basic knowledge of the
HTTP protocol. Start eating tht HTTP RFC:
http://www.w3.org/Protocols/rfc2616/rfc2616
This will also enlighten yo about the fact that a header cannot be senz
after content has been pushed out.
This said you can use output buffering
(http://www.php.net/manual/en/function.ob-start.php) to avoid output being
sent before the headers:
Example:
ob_start();
echo "some stuff";
// we decide to redirect the client
ob_end_clean(); // clear the output buffer
header('Location: http://somewhere.com');
HTH,
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php