Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- #
- public static boolean checkDetails(String username, String password) {
- #
- try {
- # if(conection.isClosed() || !connection.isValid(5000)) {
- System.out.println("Reoponing Connection");
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- con = DriverManager.getConnection("jdbc:mysql://"+databaseServer+"/"+databaseName+"?jdbcCompliantTruncation=false", databaseUser, databasePass);
- return checkDetails(username, password);
- }
- Statement statement = connection.createStatement();
- #
- ResultSet group = statement.executeQuery("SELECT * FROM user WHERE username = '"
- #
- + username + "'");
- #
- if (group.next()) {
- #
- String givenPassword = passHash(password, group.getString("salt"));
- #
- System.out.println("Loading User: " + username + " Gave Hash: " + givenPassword);
- #
- if (givenPassword.equals(group.getString("password"))) {
- #
- return true;
- #
- }
- #
- }
- #
- } catch (SQLException e) {
- #
- return false;
- #
- }
- #
- return false;
- #
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement