Advertisement
Guest User

Untitled

a guest
Nov 26th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. try {
  2. Server.conGameData = DriverManager.getConnection(
  3. "jdbc:mysql://srv.zarpor.org/zarpordb?charSet=ISO8859-1&autoReconnect=true&failOverReadOnly=false&maxReconnects=10", Server.MySQLUser,
  4. Server.MySQLPassword);
  5. Server.stmGameData = Server.conGameData.createStatement();
  6. String query = "SELECT * FROM user WHERE username = '" +playerName+ "'";
  7.  
  8. ResultSet results = Server.stmGameData.executeQuery(query);
  9. if(results.next()) {
  10. if(results.getString("username").equals(playerName) || results.getString("username").equalsIgnoreCase(playerName)) {
  11. String Pass = new String(results.getString("playerPass").getBytes("ISO-8859-1"), "ISO-8859-1");
  12. p.playerPass = Pass;
  13. Boolean updated = false;
  14. if (updated || Hash.stringToSHA1(playerPass).equals(Pass)) {
  15. playerPass = Pass;
  16. p.dbId = results.getInt("id");
  17. } else {
  18. return 3;
  19. }
  20. p.playerGroup = results.getInt("usergroupid");
  21. } else {
  22. return 12;
  23. }
  24. }
  25.  
  26. } catch (Exception e) {
  27. e.printStackTrace();
  28. System.out.println("Failed to load player: " + playerName);
  29. return 13;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement