
April 9th, 2000, 02:47 AM
|
|
PHP Programmer
|
|
Join Date: Mar 2000
Posts: 31
Time spent in forums: 36 m 43 sec
Reputation Power: 14
|
|
|
This is the example of HTTP authentication from php.net. I've read it 10 times and tried it, but I can't get it to work. Can someone explain what happens here? is $PHP_AUTH_USER an environment variable? Can I access it from every page?
<?php
if(!isset($PHP_AUTH_USER)) {
Header("WWW-Authenticate: Basic realm="My Realm"");
Header("HTTP/1.0 401 Unauthorized");
echo "Text to send if user hits Cancel buttonn";
exit;
} else {
echo "Hello $PHP_AUTH_USER.<P>";
echo "You entered $PHP_AUTH_PW as your password.<P>";
}
?>
I've heard that there is a way to make variabes availible to all pages, putting them in some sort of global file. Can I use that for authentication?
|