Re: Unix passwd file

From: Date: Fri, 04 Oct 2002 12:45:19 +0000
Subject: Re: Unix passwd file
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-118877@lists.php.net to get a copy of this message
>> Username is no problem, the Unix encrypted >> password is the one I am trying to work out. If the user has a >> password of: phprocks and in /etc/passwd >> that encrypted password works out to be: !#@KJCKMSD@, then I >> validate the user, they enter the correct username and password, >> will PHP be able to validate that the password they entered matches >> the encrypted password. Just as Peter said, you can use crypt to check the passwords, it'll be something like: if ( '!#@KJCKMSD@' == crypt( 'phprocks', substr( 'phprocks', 0, 2 ) ) ) { // Validation succeeded } else { // Invalid password } Crypt can not be unencrypted, but you can of course compare the crypted passwords... HTH Erwin

« previous php.general (#118877) next »