我正在構建的網站有一個小型管理面板。所以該網站有一個登錄頁面,但沒有註冊頁面,因爲只有1個電子郵件+密碼需要登錄1個帳戶。所以我想通過sql插入這個賬戶的憑證。密碼需要經過md5散列處理。這是我寫的sql代碼,但我得到一個錯誤:使用sql將電子郵件+ md5哈希密碼存入數據庫
insert into tblmember (memberEmail, memberWachtwoord)
values (
'".mysqli_real_escape_string('exampleemail')."',
'".hash('md5', mysqli_real_escape_string('examplepassword'))."'
);
exampleemail和examplepassword只是文本,沒有變量。 這是錯誤我得到:
error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'exampleemail')."', '".hash('md5'('examplepassword'))."')' at line 3
你在你的SQL代碼的PHP。你期望如何工作? –
如果可以,請更改密碼哈希。 MD5不再被認爲是安全的。請參閱http://security.stackexchange.com/questions/23116/md5-collision-attacks-are-the--relevant-in-password-hashing以獲取相對平衡的問題並解答原因。 – penguat