Entry
How do I check the user input password from a form with encrypted one in the Apache htpasswd file?
May 4th, 2000 12:57
Russell Speed, Nikhil Mehta, Nathan Wallace, Carlos Azevedos
The first two characters of the password are the "salt" to be passed
to crypt. So the following snippet should result in an equivalently
encrypted password for string comparision.
$salt=substr($Password_From_Passwd_File,0,2);
$pass=crypt( $Password_From_Form,$salt );
if( strcmp( $pass, $Password_From_Passwd_File ) )
// Fail authentication.