I use basic authentication like this:
[tt]
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('HTTP/1.0 401 Unauthorized');
header(' Basic realm="My Realm"');
echo 'Text to send if user hits Cancel button';
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
exit;
}
[/tt]
It always worked fine. Now I want to use it on an other server and it gives me an Internal Error!
The only difference I've noticed is the Server API... on the working machine is has the value APACHE, on the other machine CGI. Is this the problem? And if so, what do I have to change in order to get this script working ??
Hope someone can help... thnx
[tt]
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('HTTP/1.0 401 Unauthorized');
header(' Basic realm="My Realm"');
echo 'Text to send if user hits Cancel button';
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
exit;
}
[/tt]
It always worked fine. Now I want to use it on an other server and it gives me an Internal Error!
The only difference I've noticed is the Server API... on the working machine is has the value APACHE, on the other machine CGI. Is this the problem? And if so, what do I have to change in order to get this script working ??
Hope someone can help... thnx