I am trying to create a simple login script for a single user for a weblog/news system. In fact, it should be the same as how I downloaded it from some free source ages ago, but I modified the rest of the code.
at the end of news_config.php:
//news administrator settings:
$admin="example_username";
$pass="example_password";
(user/pass removed for security - included only alphanumeric characters)
and at the beginning of news_admin.php:
require "news_config.php";
if (($_SERVER['PHP_AUTH_USER'] != "$admin") || ($_SERVER['PHP_AUTH_PW'] != "$pass"))
{
header('WWW-Authenticate: basic realm="news Admin');
header('HTTP/1.0 401 Unauthorized');
echo "Authorization Required.";
exit;
}
This works perfectly on a number of websites running on a Win32 server, but on 1 and 1, my client's host (*nix server) it just doesn't log in. It seems as if the $_SERVER variables aren't being passed from the login box to the script. I have tried in different browsers and it seems that this is either a server-side or PHP coding error - can anyone tell me if it's me who's going wrong, and what I can do to fix the problem?
Thanks