> Does anybody know or have some PHP code to read the htaccess file.
Off the top of my head:
<?php
$valid = 0;
$path = "/path/to/.htpasswd";
$file = file($path) or die("Could not read $path");
while (list(,$line) = each($file)){
list($username, $password) = explode($line);
if ($username == $user && crypt($pass) == $password){
$valid = 1;
}
}
if (!$valid){
header("Location: index.htm");
exit;
}
?>
You may need to use mcrypt(), and the encryption used by your OS may or may
not be available, and your OS may or may not have been configured at some
point to use a different encryption, so the passwords in a single .htpasswd
might actually be in two different formats...
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]