note 34629 added to function.md5

From: Date: Fri, 01 Aug 2003 16:58:05 +0000
Subject: note 34629 added to function.md5
Groups: php.notes 
Request: Send a blank email to php-notes+get-53155@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+34629 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34629&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34629&report=yes

« previous php.notes (#53155) next »