I have the following code in PHP,
<?php
ob_start();
$valid_passwords = array ("matrixUlt" => "$ecurEh1FIVE");
$valid_users = array_keys($valid_passwords);
$user = $pass = null;
if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']))
{
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
}
$validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]);
if(!$validated)
{
header('WWW-Authenticate: Basic realm="You need to be authenticated to access the resource!"');
header('HTTP/1.0 401 Unauthorized');
exit("Not authorized");
echo ob_get_clean();
}
This works correctly in localhost when this [("matrixUlt" => "$ecurEh1FIVE"] username:password is given. But keeps showing auth dialog in LIVE server / production enviroment. Any ideas why this is not working?