note 34628 added to function.md5
| From: | rizvi100 at hotmail dot com | Date: | Fri, 01 Aug 2003 16:52:23 +0000 |
| Subject: | note 34628 added to function.md5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-53154@lists.php.net to get a copy of this message | ||
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!! :)
----
Manual Page -- http://www.php.net/manual/en/function.md5.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34628
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34628&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34628&report=yes