этот метод должен сравнивать логин / пароль, предоставленный пользователем, с логином / паролем, хранящимся в базе данных, но этот метод возвращает всегда false, а инструкция не работает !!
public String loginPasswordCheck() {
Connectionx cx = new Connectionx();
Connection con = (Connection) cx.Connxion("com.mysql.jdbc.Driver","jdbc:mysql://localhost/kpidb", "root", "root");
String log;
String pwd;
String checkaccess = "success";
int profil_user;
HashMap<String, String> mapLoginPWD = new HashMap<String, String>();
HashMap<String, HashMap<String, String>> mapID_LoginPWD = new HashMap<String, HashMap<String, String>>();
HashMap<String, String> temp = new HashMap<String, String>();
String sqlLogin;
sqlLogin = "select PROFIL_USER_ID,login ,password from profil_user;";
try {
st = (PreparedStatement) con.prepareStatement(sqlLogin);
ResultSet rs1 = st.executeQuery();
while (rs1.next()) {
profil_user = rs1.getInt("PROFIL_USER_ID");
profil_user_id = String.valueOf(profil_user);
log = rs1.getString("login");
pwd = rs1.getString("password");
mapLoginPWD.put(log, pwd);
mapID_LoginPWD.put(profil_user_id, mapLoginPWD);
Iterator iteratorkeymaploginPWD = mapID_LoginPWD.keySet().iterator();
while (iteratorkeymaploginPWD.hasNext()) {
String myKeylog = (String) iteratorkeymaploginPWD.next();
temp = mapID_LoginPWD.get(myKeylog);
Iterator iteratortemp = temp.keySet().iterator();
while (iteratortemp.hasNext()) {
String keyTemplog = (String) iteratortemp.next();
String valueTemppwd = temp.get(keyTemplog);
temp.clear();
mapID_LoginPWD.clear();
boolean bool = true;
if (!(this.login.equalsIgnoreCase(keyTemplog)) && !(this.password.equalsIgnoreCase(valueTemppwd)) && (bool)) {
bool = false;
checkaccess = "fail";
} else {
checkaccess = "success";
break;
}
}
}
}
}
catch (SQLException e) {
e.printStackTrace();
}
return checkaccess;
}