MySQL username and password check
I want to create a simple (non-secure) login-check from mysql database, where I have a table which has Login_name and Password fields. However, my system logs in if the Login_name is right no matter what password the user inserts. How do I fix the system to check that both match the 开发者_StackOverflowuser? My SQL procedure:
CREATE PROCEDURE `usp_getUserAccount`(IN username VARCHAR(255), IN password VARCHAR(255))
BEGIN
select Name, Access_level_group, ID
from User_accounts
where Password = password
AND Login_name = username;
END
$$
I believe MySQL is case insensitive, so Password = password is always true. You need to clarify that you are wanting to check User_accounts.Password, instead of just the password parameter. So either change the name of your IN parameter, or replace Password with User_accounts.Password.
精彩评论