I'm new to this and need help.
I want to set up an http authentication on my site and have used the following code:
<?php
if (isset($_SERVER['PHP_AUTH_USER']) &&
isset($_SERVER['PHP_AUTH_PW']))
{
echo "Welcome User: " . $_SERVER['PHP_AUTH_USER'] .
" Password: " . $_SERVER['PHP_AUTH_PW'];
}
else
{
header('WWW-Authenticate: Basic realm="Restricted Section"');
header('HTTP/1.0 401 Unauthorized');
die("Please enter your username and password");
}
?>
When I run the script I get, "Please enter your username and password."
Obviously the 'die' code has run but I don't understand why.
Can anyone help?
'H'