public boolean validLogin(String username, String password) { boolean validUser = false; try { dbStm = dbCon.prepareStatement( "SELECT * FROM userInfo WHERE username = "******"\"" + username + "\"" + ";"); dbRs = dbStm.executeQuery(); while (dbRs.next()) { String un = ""; String pw = ""; un = dbRs.getString("username"); System.out.println(un + " " + username); pw = dbRs.getString("password"); System.out.println(pw + " " + password); if (((username.equals(un) == true) && ((password.equals(pw) == true)))) { validUser = true; System.out.println("Valid User"); } } } catch (Exception e) { e.printStackTrace(); } return validUser; }
public void systemClose() { if (client.isConnected == true) { client.disconnect(messageArea, messageInputArea, superUser); } try { if (dbCon != null) { dbCon.close(); } } catch (Exception e) { e.printStackTrace(); } System.exit(0); }