password protect WRM2
| From: | David Smith | Date: | Sun, 07 Jan 2001 11:03:55 +0000 |
| Subject: | password protect WRM2 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-33082@lists.php.net to get a copy of this message | ||
I am currently using the following code to password protect a file but it
uses only one login/pass. How would I change this code to accept multiple
logins by checking fields login/pass from a mysql db?
Thanks,
David Smith
<?php
if (!isset($PHP_AUTH_USER))
Header("WWW-Authenticate: Basic realm=\"Combat Flight Center MySQL Admin
Area\"");
Header("HTTP/1.0 401 Unauthorized");
$REMOTE_USER = "combatfs";
$REMOTE_PASSWORD = "******";
$PHP_AUTH_USER = "combatfs";
$PHP_AUTH_PW = "******";
print "You hit cancel! if it was an accident please <a
href=\"$PHP_SELF\">click here</a> to try again.";
exit;
} else if ((!$PHP_AUTH_USER == "user") && ($PHP_AUTH_PW == "pass"))
print "You are unauthorized";
}
?>