I am trying to use PHP_AUTH_USER and PW for the first time and I cant seem to get it to work at all,
I tried to make a test php document to get it to work,
<?php
// File Name: auth01.php
// Check to see if $PHP_AUTH_USER already contains info
if (!isset($PHP_AUTH_USER)) {
// If empty, send header causing dialog box to appear
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
// If not empty, display values for variables
else {
echo "
<P>You have entered this username: $PHP_AUTH_USER<br>
You have entered this password: $PHP_AUTH_PW<br>
The authorization type is: $PHP_AUTH_TYPE</p>
";
}
?
But i get errors like;
Warning: Cannot send session cookie - headers already sent by (output started at /home/sites/site3/web/test.php:1) in /home/sites/site3/web/test.php on line 1
Warning: Cannot send session cache limiter - headers already sent by (output started at /home/sites/site3/web/test.php:1) in /home/sites/site3/web/test.php on line 1
Warning: Cannot add header information - headers already sent by (output started at /home/sites/site3/web/test.php:1) in /home/sites/site3/web/test.php on line 1
Warning: Cannot add header information - headers already sent by (output started at /home/sites/site3/web/test.php:1) in /home/sites/site3/web/test.php on line 1
Authorization Required.
I tried thowing a session_start(); at the begining but that didnt work either,
I am using php4.0.1pl2
Thanks ofr any help;
jake