Advertisement
Guest User

Untitled

a guest
Jun 9th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. First:
  2.  
  3. /**
  4. * Check the username and password and make sure they match up.
  5. * @param user
  6. * The username of the person who is
  7. * connecting to the <code>Server</code>.
  8. * @param pass
  9. * The password of the person who is
  10. * connecting to the <code>Server</code>.
  11. * @param right
  12. * The rights of the person - either
  13. * Administrator, Moderator, or a regular
  14. * player.
  15. * @param ip
  16. * The IP of the player who is connecting
  17. * to the <code>Server</code>.
  18. * @param height
  19. * The height of the person. The height will
  20. * define whether or not the he/she is in
  21. * world one or world two.
  22. * @param x
  23. * The x coordinate of the player for where
  24. * he/she stands.
  25. * @param y
  26. * The y coordinate of the player for where
  27. * he/she stands.
  28. * @param id
  29. * The ID of the player for when they log in.
  30. * Each person has an ID when connecting to
  31. * the <code>Server</code> and once someone
  32. * disconnects, the ID will be removed from that
  33. * person and the new player will be given a
  34. * different ID to use.
  35. * @return
  36. * <code>true</code> if the player's username,
  37. * password, rights, IP, height, x, y and ID are
  38. * found in the Database and they all match up
  39. * accordingly.
  40. * <code>false</code> otherwise.
  41. */
  42. public static boolean checkPlayer(String user, String pass, int right, String ip, int height, int x, int y, int id) {
  43. try {
  44. if (questionStatement("SELECT username FROM members WHERE username='" + user + "' AND password='" + pass + "' AND rights='" + right + "' AND ip='" + ip + "' AND height='" + height + "' AND x='" + x + "' AND y='" + y + "' AND id='" + id + "'")) {
  45. return true;
  46. }
  47. return false;
  48. } catch (Exception e) {
  49. return false;
  50. }
  51. }
  52.  
  53. Second:
  54.  
  55. /**
  56. * Check the username and password and make sure they match up.
  57. * @param user
  58. * @param pass
  59. * @param right
  60. * @param ip
  61. * @param height
  62. * @param x
  63. * @param y
  64. * @param id
  65. */
  66. public static boolean checkPlayer(String user, String pass, int right, String ip, int height, int x, int y, int id) {
  67. try {
  68. if (questionStatement("SELECT username FROM members WHERE username='" + user + "' AND password='" + pass + "' AND rights='" + right + "' AND ip='" + ip + "' AND height='" + height + "' AND x='" + x + "' AND y='" + y + "' AND id='" + id + "'")) {
  69. return true;
  70. }
  71. return false;
  72. } catch (Exception e) {
  73. return false;
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement