note 22075 added to function.md5
| From: | willmoss at btinternet dot com | Date: | Wed, 05 Jun 2002 17:34:37 +0000 |
| Subject: | note 22075 added to function.md5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31501@lists.php.net to get a copy of this message | ||
It should also be pointed out that PHP contains no functions for decrypting a hashed string.
If you want to use md5() to encrypt users' passwords in a database, you would go about coding
the login by encrypting the submitted password
ie.
$user_submitted_password = md5($user_submitted_password);
$result = mysql_query("SELECT * FROM users WHERE
encrypted_password='$user_submitted_password'");
if (mysql_num_rows($result) < 1) { echo "Invalid password"; exit; }
else { echo "Correct password!"; }
--
http://www.php.net/manual/en/function.md5.php
http://master.php.net/manage/user-notes.php?action=edit+22075
http://master.php.net/manage/user-notes.php?action=delete+22075
http://master.php.net/manage/user-notes.php?action=reject+22075