louis12356 louis12356 - 6 months ago 39
HTML Question

PHP/SQL Login Form - how to check password in database

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 ?

Answer Source
$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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download