第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如果密碼包含在要解析的字符串中,Password_verify() 給出 true

如果密碼包含在要解析的字符串中,Password_verify() 給出 true

PHP
狐的傳說 2023-08-19 16:45:46
幾天來我遇到了一個關(guān)于password_verify()的問題。在我的網(wǎng)址中輸入密碼失敗之前我沒有注意到這一點(diǎn)。解釋一下,我正在開發(fā)一個 Web 服務(wù),為了進(jìn)行身份驗證,我需要在請求 URL 中使用密碼和 ID。這是我的代碼 if ($stmt->prepare("SELECT hashedPWD FROM `user` WHERE `id` = ?")){ // Trying to get the hashed pwd stored in DB            $stmt->bind_param("i", $id);            $stmt->execute();            $stmt->bind_result($pwdHash); // $pwdHash contains the password hashed by password_hash() when the account was created            $stmt->fetch();            $stmt->close();        }$password = "test"; // The password in URL which is the good one$isPwdGood = password_verify($password, $pwdHash);var_dump($isPwdGood); // returns true, seems good right there$password = "testtttttttttt"; // contains the real password with some others characters  $isPwdGood = password_verify($password, $pwdHash);var_dump($isPwdGood); // returns also true這里的問題是,當(dāng)我想確認(rèn)我的客戶的身份時,我需要確保密碼是他給我的密碼,但是使用password_verify()我可以獲得一個包含真實(shí)密碼的錯誤密碼,并且它會起作用。
查看完整描述

1 回答

?
慕哥6287543

TA貢獻(xiàn)1831條經(jīng)驗 獲得超10個贊

我沒有觀看創(chuàng)建帳戶的整個過程,應(yīng)該這樣做,因為我剛剛看到使用的函數(shù)是 crypt() 并且(我不知道為什么)它與以前的鹽和哈希值配合得不好密碼。

我嘗試切換到我向您展示的函數(shù),即password_hash(),它效果更好!

查看完整回答
反對 回復(fù) 2023-08-19
  • 1 回答
  • 0 關(guān)注
  • 120 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號