我有一个需要用户名、密码和 ID 的登录系统。数据库中的密码以 MD5 格式加密。我的测试密码是test1
,加密后的密码是5a105e8b9d40e1329780
。登录屏幕上的用户应输入test1
密码并被允许进入系统。我只是继续收到我的弹出消息。
我的 SQL 查询如下所示:
String SQL = "SELECT login_judge.username, login_judge.password ,criminalrecords.ID FROM login_judge, criminalrecords "
+ "WHERE username = ? and password = md5(?) and ID = ?";
pst = conn.prepareStatement(SQL);
pst.setString(1, usernameF.getText());
pst.setString(2, passwordF.getText());
pst.setString(3, caseNoF.getText());
rs = pst.executeQuery();
if(rs.next())
{
// rest of code
}
else
{
// joption pane displaying info that something is wrong.
}
来自 phpMyadmin
UPDATE `w1283057`.`login_judge` SET `password` = MD5( 'test1' ) WHERE `login_judge`.`username` = 'test1';