thinkphp Member Login Password verification MD5 issue.

Source: Internet
Author: User
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?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.