Hi,
I'm having a few problems with setting up authentication on an area of a site. The code I'm using is below. Everything works fine for a correct username and password. But if an incorrect username/password is entered it appears to get stuck in a infinite loop. Can anyone point me in the right direction or give me an example.
Thanks
Julian
<?php
if (!isset($PHP_AUTH_USER))
{
Header("WWW-authenticate: basic realm=\"Intranet\"");
Header("HTTP/1.0 401 Unauthorized");
echo "<H1>Authorisation Required</H1><P>\n";
exit;
}
else
{
// authenticate username and password
$response = exec(EscapeShellCmd("/usr/bin/pwd_auth_mod $PHP_AUTH_USER $PHP_AUTH_PW"));
if ($response != "OK")
{
unset($PHP_AUTH_USER);
unset($PHP_AUTH_PW);
Header("Location: login.php");
}
else
{
echo "Logged in successfully";
}
}
?>