dourenzhou8740 2017-09-22 07:12
浏览 77
已采纳

PHP / SQL登录表单 - 如何检查数据库中的密码

at the moment, i check the username and passwort of a HTML form like this on my database:

$exc = $dbh->prepare("SELECT id, cid, fullname FROM user WHERE username LIKE :username AND password LIKE :password");

I need to check both CASE SENSITIVE when executing the query.

Database data:

username: louis
password: goal43

Form data:

username: LOUIS
password: GOAL43

returns true - how do i fix this ?

  • 写回答

4条回答 默认 最新

  • dongxuan2577 2017-09-22 07:28
    关注
    $exc = $dbh->prepare("SELECT id, cid, fullname FROM user WHERE BINARY username LIKE :username AND BINARY password LIKE :password");
    

    I hope it helps you. The link I've given to you

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?