View Single Post
Old 06-21-2002, 01:51 PM  
buran
Confirmed User
 
Join Date: Mar 2002
Location: how'd I get here?
Posts: 264
The previous posters are correct, crypt() is a one way encryption, you must take the plain text entered by the user and the first two characters of the encrypted password. If $PHP_AUTH_PW is the password entered by the user, and $password is what you've found in the .htpasswd file (or mysql), this could should work:

$compare = crypt($PHP_AUTH_PW, substr($password, 0, 2);
if($compare == $password) {
echo "Logged in";
} else {
echo "Password not valid";
exit;
}
__________________
[this signature intentionally left blank]
buran is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote