I registered the password with MD5 encryption in the way of storage in MySQL, in the login with MD5 () comparison, the value has been wrong, resulting in a failure, to find answers
Reply to discussion (solution)
Put the code downstairs.
This is the function module of the judgment:
function PD () {//Verify 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 "";
}
Else
{echo "";}
}
The MD5 value in the database;
Root2
E10adc3949ba59abbe56e057f20f88;
The value of the page display;
e10adc3949ba59abbe56e057f20f883e
$pwd =md5 (Trim ($_post[' pwd '));//If not, regenerate a MD5 value, put it in the database and try again, and see if it's wrong to insert it.
echo MD5 (' Root2 '); mysql_connect (); $rs = mysql_query ("Select MD5 (' Root2 ')");p Rint_r (Mysql_fetch_row ($rs));
9b70d6dbfb1457d05e4e2c2fbb42d7dbarray ( [0] = 9b70d6dbfb1457d05e4e2c2fbb42d7db)
There's no e10adc3949ba59abbe56e057f20f883e.
The page shows this e10adc3949ba59abbe56e057f20f883e
No, no, no, it's 123456, and you're root2.
PS again to say a word to look at you the database display is basically the number of bits that should be set in the password field is not reasonable caused by 2 characters less than char (32)
1.desc xx Look at the table structure, password field length requires 32 bits
2.
echo MD5 (' Root2 '); 9b70d6dbfb1457d05e4e2c2fbb42d7db
E10ADC3949BA59ABBE56E057F20F883E is the value of MD5 (123456).
The landlord can give the plaintext password, and the password recorded in the database.