Member Registration time password MD5 encrypted to the database, now member login to MD5 password after the database query should be how to write? I get the form MD5 after the database query why not the same, my Code is
Class Adminaction extends action{ function index () { if (isset ($_post[' username '))} { if (isset ($_post[') Username ']) &&isset ($_post[' password ')) { $secure _code = C (' Secure_code '); $userpassword =md5 ($secure _code.md5 ($_post["password")); $db =m (); $select = $db->query ("SELECT * from developers where username=". $_post[' username ']. "and password=". $ UserPassword. ""); echo $db->getlastsql (); exit;
How should I write it?
Reply to discussion (solution)
On a login function you sent three posts in three consecutive days, you can not think about it, search for a solution
MD5 ($secure _code.md5 ($_post["password"));
This is the original password to add something, in the verification of the time you also add not to be finished
1: $userpassword =md5 ($secure _code.md5 ($_post["password")); Why MD5 to encrypt two times?
2: Since the last statement printed, the password of the MD5 with the eyes and the database encrypted comparison, is it consistent?
MD5 ($secure _code.md5 ($_post["password"));
This is the original password to add something, in the verification of the time you also add not to be finished
+1! It turns out how you encrypt before you put it in the database. Copy the statement.
Are you sure the encryption method is the same when inserting and querying?