0

Hi,
I dont know how to check password availabilty from mysql database, Can anyone tell me about with simple and brief explanation in php. if the password is already in db, it should show password is match otherwise password do not match . This should show in the field itself....
Thanks and Regards,

3
Contributors
2
Replies
18
Views
2 Years
Discussion Span
Last Post by Taywin
1

Passwords shouldn't be stored in the database at all, nor should it be allowed to check if passwords exist.

Usernames are a different story. You could check your db for the entered name (triggered on focus lost or something) and warn the user that the name is taken. The only way of being 100% sure there is only one username is by enforcing a UNIQUE key on the table and catching the exception if the entry is not unique. Otherwise it could still be possible to get a duplicate in, for instance inbetween the check and the actual entry.

0

Actually, the OP is asking how to validate user password from the database.

However, first, you need to check how you store the password in the database. Practically, you should NEVER store the password in plain text in the database. You need to encrypt it somehow and save in the database. Then when you get user password input, encrypt it the same way you did with the stored data, and then compare the result with whatever in the database. If it doesn't match, then you reject it; otherwise, allow log in.

Edited by Taywin

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.