Home >Database >Mysql Tutorial >Code for html-php login page, md5 encryption
md5htmlmysqlphp
I used md5 to encrypt the password during registration. How to write the login code? I beg you
$str = "123";//Unencrypted password
$mima=md5($str);
echo $mima;
When logging in, the background will encrypt the entered password once with md5 and compare it with the password in the database
Also use the md5 function to encrypt the entered password, and then compare it
At the front desk, enter password=123456
Receive the password in the background, encrypt the password with MD5, and compare the encrypted result with the one stored in the database
After entering the password, it is sent to the background and after MD5 encryption, it can be compared with the database. MD5 is one-way and there is no decryption, so this is the only way
Also write encryption when logging in. MD5 cannot be decrypted reversely. You can only compare the password generated after encryption with the one in the database.
$password=md5($_POST['password']);
Obtain the password from the front-end page, encrypt it with md5 and save it to $password, and then determine whether $password is consistent with what is saved in the database