In general, a member to provide registration of the site must collect the user's password, how to save the user password is a problem. We certainly cannot store passwords in plaintext in the database, because in this way, the average administrator can see the user's password, which is obviously a very dangerous thing for the user.
How to solve this problem, we can take such a strategy.
First introduce the use of the MD5 function in PHP:
Copy CodeThe code is as follows:
$PSWD 1=md5 ("cenusdesign");
echo $PSWD 1; The result of the operation is: FC60EC37D1C08D5B0FB67A8CD934D5BA
$PSWD 2=md5 ("cenusdesign");
echo $PSWD 2; The result of the operation is: 067577d9fc109c80538c81d6f02bd293
?>
Obviously, after MD5 encryption, the original "Cenusdesign" is transformed into a set of 32-bit strings, and even if the case of a letter changes, this set of strings will change dramatically.
Cenus Design recommends that when the user registers, the password is converted first through MD5, and then the encrypted database is converted. When the user logs on, the password is MD5 converted, and then compared with the set of MD5 encrypted strings in the database. This makes it possible to do a password-specific operation without knowing the user's exact password.
Author: Sunec
Original download: Cenus Blog
All rights reserved. The author and original source and this statement must be indicated in the form of a link in the reprint.
http://www.bkjia.com/PHPjc/319127.html www.bkjia.com true http://www.bkjia.com/PHPjc/319127.html techarticle In General, a member to provide registration of the site must collect the user's password, how to save the user password is a problem. We certainly cannot store the password in clear text in the way of the number ...