Home > Database > Mysql Tutorial > Code for html-php login page, md5 encryption

Code for html-php login page, md5 encryption

WBOY
Release: 2016-08-04 08:53:36
Original
2357 people have browsed it

md5htmlmysqlphp

I used md5 to encrypt the password during registration. How to write the login code? I beg you

Reply content:

$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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template