Authentication
| From: | Sergey Zorchenko | Date: | Mon, 15 Oct 2001 11:13:19 +0000 |
| Subject: | Authentication | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-9848@lists.php.net to get a copy of this message | ||
Can anyone advice me any to realize a directory authentication with
Apache/php4.0.6/MySQL ?
I mean that Apache must to use MySQL database for authentication..
plz :)
i have made an 'access.php' that contains:
---------------------------
function deny() {
header("WWW-Authenticate: Basic realm=\"My Realm\"");
header("HTTP/1.0 401 Unauthorized");
die ("sorry, access denied\n");
}
if(isset($PHP_AUTH_USER)) {
$showqueries = 0;
$user = $db->query("SELECT nick, email FROM members WHERE name =
'$PHP_AUTH_USER' AND pass = PASSWORD('$PHP_AUTH_PW')");
$row = $user->fetch();
if (!isset($row->nick)){
deny();
}
} else {
deny();
}
-----------------------------
but this means , that i need to inlcude this file to _all_ php-files in
'secure' directory :(