I have a script with HTTP authentication. It works perfectly on my local server but when I deployed it to another server I met following situation.
Every time when I pressed "OK" Login/Password window appears again not depending from data I inputed. I tried to debug it and in the end I took the simple example from PHP manual:
Code: Select all
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
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>";
}
?>Thanks for you suggestions.