note 34629 deleted from function.md5 by mazzanet
| From: | mazzanet@php.net | Date: | Mon, 03 Oct 2005 09:17:32 +0000 |
| Subject: | note 34629 deleted from function.md5 by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96249@lists.php.net to get a copy of this message | ||
Note Submitter: Rizwan Kaif
----
The md5() function is very useful for Password encryption. Keep in mind that we can not Decrypt it.
The most simplest method to use md5() function PHP with MySQL is as follows:
Insert the record into the MySQL Database using a query like:
$query = "INSERT INTO user VALUES ('DummyUser',md5('DummyPassword'))";
And then for matching the password use:
$password = md5($password);
$query = "SELECT * FROM user WHERE username='DummyUser' AND
password='DummyPassword'";
In the above code you can use your Variables instead of DummyUser & DummyPassword. The length of
the Password field in my DB is 60 char.
Hope this helps!! :)