RE: [PHP] Encryption Question
| From: | John Holmes | Date: | Tue, 24 Sep 2002 00:57:45 +0000 |
| Subject: | RE: [PHP] Encryption Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117336@lists.php.net to get a copy of this message | ||
> I want to compare a password to a encrypted password stored in my
mySQL
> database using password('password'), what's the best way to compare
the
> two?
>
> Encrypted the password sent by the user and compare or pull the
password
> from the database based on username, decrypt it and then compare?
SELECT 1 FROM table WHERE password_column = PASSWORD('$password') AND
username = '$username'
If a row is returned, the username and password match what's in the
database. $password and $username would come from your form or
whatever...
---John Holmes...