久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <i id='fxxUs'><tr id='fxxUs'><dt id='fxxUs'><q id='fxxUs'><span id='fxxUs'><b id='fxxUs'><form id='fxxUs'><ins id='fxxUs'></ins><ul id='fxxUs'></ul><sub id='fxxUs'></sub></form><legend id='fxxUs'></legend><bdo id='fxxUs'><pre id='fxxUs'><center id='fxxUs'></center></pre></bdo></b><th id='fxxUs'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='fxxUs'><tfoot id='fxxUs'></tfoot><dl id='fxxUs'><fieldset id='fxxUs'></fieldset></dl></div>

      <bdo id='fxxUs'></bdo><ul id='fxxUs'></ul>

      1. <small id='fxxUs'></small><noframes id='fxxUs'>

        <legend id='fxxUs'><style id='fxxUs'><dir id='fxxUs'><q id='fxxUs'></q></dir></style></legend>
        <tfoot id='fxxUs'></tfoot>

        PHP &amp;MYSQL:使用 bcrypt 哈希并使用數據庫驗證

        PHP amp; MYSQL: using bcrypt hash and verifying password with database(PHP amp;MYSQL:使用 bcrypt 哈希并使用數據庫驗證密碼)

            <bdo id='R98ST'></bdo><ul id='R98ST'></ul>

          • <tfoot id='R98ST'></tfoot>

                <small id='R98ST'></small><noframes id='R98ST'>

              1. <legend id='R98ST'><style id='R98ST'><dir id='R98ST'><q id='R98ST'></q></dir></style></legend>
                  <tbody id='R98ST'></tbody>
                  <i id='R98ST'><tr id='R98ST'><dt id='R98ST'><q id='R98ST'><span id='R98ST'><b id='R98ST'><form id='R98ST'><ins id='R98ST'></ins><ul id='R98ST'></ul><sub id='R98ST'></sub></form><legend id='R98ST'></legend><bdo id='R98ST'><pre id='R98ST'><center id='R98ST'></center></pre></bdo></b><th id='R98ST'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='R98ST'><tfoot id='R98ST'></tfoot><dl id='R98ST'><fieldset id='R98ST'></fieldset></dl></div>
                  本文介紹了PHP &amp;MYSQL:使用 bcrypt 哈希并使用數據庫驗證密碼的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在使用 Andrew Moore 先生的方法 (您如何在 PHP 中使用 bcrypt 對密碼進行散列處理?) 的散列用戶密碼.我所做的是我有一個注冊頁面,它使用

                  I'm using Mr. Andrew Moore's method (How do you use bcrypt for hashing passwords in PHP?) of hashing user's password. What I did is I have a registration page and it uses

                  $bcrypt = new Bcrypt(12);
                  $pass = $_POST['password']; //register password field
                  $hash= $bcrypt->hash($pass);
                  
                  // then inserts $hash into database with users registered email (I've checked my mysql database and it indeed has an hashed item
                  

                  然后我有一個登錄頁面,由電子郵件和密碼字段組成.我的想法是電子郵件地址在我的數據庫中是唯一的.因此,考慮到這一點,我制作了一個腳本,它首先檢查用戶的電子郵件地址,然后如果存在現有的電子郵件地址,請使用此驗證哈希密碼

                  Then I have a login page, consisting of email and password fields. My thought is that email addresses are unique in my database. So with that in mind, I made a script where it check's users email address first, then if there is an existing one, verify the hash password with this

                  $bcrypt = new Bcrypt(12);
                  
                  $email = $_POST['email']; //from login email field
                  $pass_l = $_POST['password']; // from login password field
                  $hash_1= $bcrypt->hash($pass_1);
                  
                  $chk_email= $dbh->prepare("SELECT password FROM table WHERE email = ?");
                  $chk_email -> execute(array($email));
                  
                  while($row = $chk_email->fetch(PDO::FETCH_ASSOC)){
                      $chk_pass = $row['password']; //inside a while loop to get the password
                      $pass_isGood = $bcrypt->verify($hash_1, $chk_pass);
                      var_dump($pass_isGood); // I'm getting false
                  
                  }
                  

                  我不確定我做錯了什么,我應該說實話.我已經將我的 tablefield 設置為 text 甚至 varchar(256)

                  I'm not sure what I'm doing wrong, I'm supposed to get true. And I have set my tablefield to text or even varchar(256)

                  推薦答案

                  使用Andrew Moore的課,需要調用類 verify() 方法來驗證用戶的密碼是否與哈希匹配.您傳遞給它的兩個參數是用戶輸入的明文密碼和您存儲在數據庫中的哈希值.

                  Using Andrew Moore's class, you need to call the class verify() method to verify that the user's password matches the hash. The two parameters you pass to it are the plaintext password the user entered and the hash that you stored in the database.

                  您似乎向 verify() 傳遞了第二個散列密碼,這就是它不起作用的原因.將明文密碼作為第一個參數傳入.

                  It seems you passed a second hashed password to verify() instead, which is why it's not working. Pass in the plaintext password as the first argument.

                  這篇關于PHP &amp;MYSQL:使用 bcrypt 哈希并使用數據庫驗證密碼的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                    <bdo id='8i6uq'></bdo><ul id='8i6uq'></ul>

                    <small id='8i6uq'></small><noframes id='8i6uq'>

                    <i id='8i6uq'><tr id='8i6uq'><dt id='8i6uq'><q id='8i6uq'><span id='8i6uq'><b id='8i6uq'><form id='8i6uq'><ins id='8i6uq'></ins><ul id='8i6uq'></ul><sub id='8i6uq'></sub></form><legend id='8i6uq'></legend><bdo id='8i6uq'><pre id='8i6uq'><center id='8i6uq'></center></pre></bdo></b><th id='8i6uq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8i6uq'><tfoot id='8i6uq'></tfoot><dl id='8i6uq'><fieldset id='8i6uq'></fieldset></dl></div>
                        <tfoot id='8i6uq'></tfoot>
                        <legend id='8i6uq'><style id='8i6uq'><dir id='8i6uq'><q id='8i6uq'></q></dir></style></legend>

                              <tbody id='8i6uq'></tbody>
                            主站蜘蛛池模板: 香蕉av免费 | 亚洲视频在线看 | 91久久久久久久久久久 | 欧美精品福利视频 | 99精品久久 | 中文字幕亚洲欧美日韩在线不卡 | 日韩一区二区在线视频 | 国产一区二区三区不卡av | 国产精品theporn | 91精品国产91 | 日韩精品一区二区三区久久 | 99精品国产一区二区青青牛奶 | 色婷婷av一区二区三区软件 | 久久国产区 | 亚洲国产视频一区二区 | 91色网站| 中文字幕av网站 | 国产精品一区二区在线播放 | 国产亚洲精品精品国产亚洲综合 | 国产线视频精品免费观看视频 | 亚洲精品久久久一区二区三区 | 欧美一区二区三区 | 操亚洲 | 中文字字幕一区二区三区四区五区 | 日韩欧美在线观看 | 国产网站在线免费观看 | 日本三级在线网站 | 91精品在线观看入口 | 国产精品久久久久久久久久久久久 | 成人在线视频免费观看 | 久久久久一区 | 欧美日韩国产在线 | 国产精品av久久久久久久久久 | 亚洲小视频在线观看 | 亚洲成av人片在线观看 | 精品色| 亚洲在线电影 | 免费的日批视频 | 日韩中文一区二区三区 | 午夜免费视频 | 一级爱爱片 |