I used MD5 encryption to store and compare the MD5 password in mysql during registration. I used md5 () for comparison during login. The value has never been correct, as a result, the comparison fails.
Reply to discussion (solution)
Post the code downstairs
This is the functional module for judgment:
Function pd () {// verify that the password is correct
$ Id = $ _ POST ['id'];
$ Pwd = trim (md5 ($ _ POST ['pwd']);
Echo "$ pwd "."
";
$ SQL = mysql_query ("SELECT * FROM 'XX' WHERE 'id' = '$ ID' AND 'password' =' $ pwd '");
$ SQL _p = mysql_num_rows ($ SQL );
Echo "$ SQL _p ";
If ($ SQL _p = 0 ){
Echo "script" alert ('incorrect password '); window. location. herf = 'index. php'; script ";
}
Else
{Echo "script" alert ('correct password'); script ";}
}
Md5 value in the database;
Root2
E10adc3949ba59abbe56e057f20f88;
The value displayed on the webpage;
E10adc3949ba59abbe56e057f20f883e
$ Pwd = md5 (trim ($ _ POST ['pwd']); // if the problem persists, generate a new md5 value and put it in the database and try again, check if it was inserted incorrectly.
echo md5('root2');mysql_connect();$rs = mysql_query("select md5('root2')");print_r(mysql_fetch_row($rs));
9b70d6dbfb1457d05e4e2c2fbb42d7dbArray( [0] => 9b70d6dbfb1457d05e4e2c2fbb42d7db)
There is no e10adc3949ba59abbe56e057f20f883e
The e10adc3949ba59abbe56e057f20f883e shown on the webpage
It's not surprising that 123456 won't touch root2 at all.
PS: You can just say that your database is not fully displayed. Basically, it should be because the number of bits set in the password field is unreasonable, resulting in at least two characters less than char (32 ).
1. desc xx: check the table structure. the password field must be 32 characters long.
2.
echo md5('root2'); //9b70d6dbfb1457d05e4e2c2fbb42d7db
E10adc3949ba59abbe56e057f20f883e is the md5 (123456) value.
The landlord can provide the plaintext password and the password recorded in the database.