note 15345 added to function.crypt
| From: | SeanECoates at yahoo dot ca | Date: | Thu, 06 Sep 2001 13:18:18 +0000 |
| Subject: | note 15345 added to function.crypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17720@lists.php.net to get a copy of this message | ||
Here's a function I use to compare a crypt()'ed password to a user-supplied plaintext
version:
function password_compare($plaintext, $crypted) {
return (crypt($plaintext, substr($crypted, 0, 2)) == $crypted);
}
returns true if the plaintext password properly matches the evcrypted password (note: 2 character
salt. You can change this -- it's the third param in substr())
S
http://www.php.net/manual/en/function.crypt.php