How to use sha256 in php5.3.0

后端 未结 5 1771
时光取名叫无心
时光取名叫无心 2021-02-01 01:32

I\'m using sha256 to encrypt the password. I can save the sha256 encrypted password in mysql. But i can\'t login with the same clause.

Insert code:



        
5条回答
  •  既然无缘
    2021-02-01 01:47

    Could this be a typo? (two Ps in ppasscode, intended?)

    $_POST['ppasscode'];
    

    I would make sure and do:

    print_r($_POST);
    

    and make sure the data is accurate there, and then echo out what it should look like:

    echo hash('sha256', $_POST['ppasscode']);
    

    Compare this output to what you have in the database (manually). By doing this you're exploring your possible points of failure:

    1. Getting password from form
    2. hashing the password
    3. stored password
    4. comparison of the two.

提交回复
热议问题