so i've been trying to set up a database-based password protection scheme for this site i'm working on, and i've gotten seriously stuck.
i'm running php3 as a module on iis, and i've turned off the windows integration garbage on the folder i want secured. tacking the script below into an include used on all my pages seemed to do the trick, but that was in netscape 4.7. when i test the page in ie 5 and mozilla 0.9.6, i get tossed straight to the "Unauthorized" page without being prompted for a username/password ...
any idea what i'm missing?
tia.
now, that script:
if(!isset($PHP_AUTH_USER)) {
Header( "HTTP/1.0 401 Unauthorized");
Header("WWW-Authenticate: Basic realm=\"Restricted\"");
}
else {
$query = "SELECT userID, username, password FROM accounts
WHERE password = '$PHP_AUTH_PW' AND username = '$PHP_AUTH_USER'";
$result = @($query)
or die($query_error);
$num = mysql_numrows($result);
if ($num != "0") {
$row = mysql_fetch_array ($result);
$userID = $row["userID"];
$authenticated = "1";
echo $userID;
}
}
if(!$authenticated) {
header("WWW-Authenticate: Basic realm=\"Restricted\"");
header("Status: 401 Unauthorized");
exit;
}