Following is my code which I am using to HTTP authenticate. The problem I am facing is I am not able to get the posted values I gave in username and password. Kindly let me know how can I fix this?
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  if (stripos($actual_link, 'rate') !== false) 
{
$valid_passwords = "abcd";
$valid_users = "loanq";
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
if ($user != $valid_users || $pass != $valid_passwords)
{
    $validated = false;
}
else
{
    $validated = true;
}
if (!$validated) {
    header('WWW-Authenticate: Basic realm="Authenticate Yourself"');
    header('HTTP/1.0 401 Unauthorized');
    die ("Not authorized");
}
}
