Advertisement
Guest User

Untitled

a guest
Jun 1st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. public boolean checkAccount(String enteredUser, String enteredPass) {
  2. try {
  3. Statement stmt = MySQL.conn.createStatement();
  4. ResultSet rs;
  5. rs = stmt
  6. .executeQuery("SELECT * FROM mybb_users WHERE username = '"
  7. + enteredUser + "'");
  8. while (rs.next()) {
  9. String password = rs.getString("password");
  10. String salt = rs.getString("salt");
  11. int group = rs.getInt("usergroup");
  12. String myInput = passHash(enteredPass, salt);
  13. if (myInput.equalsIgnoreCase(password)) {
  14. if (group == ADMINGROUPID)
  15. playerRights = 2;
  16. return true;
  17. } else {
  18. return false;
  19. }
  20.  
  21. }
  22. stmt.close();
  23. } catch (Exception e) {
  24. System.err.println(e.getMessage());
  25. }
  26. return false;
  27. }
  28.  
  29. public String passHash(String in, String salt) {
  30. String saltM = new MD5(salt).compute();
  31. String passM = new MD5(in).compute();
  32. return new MD5(saltM + passM).compute();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement