Advertisement
Guest User

Untitled

a guest
May 12th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1.     public void checkSQL() {
  2.         try {
  3.           if(Server.s.myConnection.isClosed() || !Server.s.myConnection.isClosed()) {
  4.             Class.forName("org.gjt.mm.mysql.Driver");
  5.                 Server.s.myConnection = DriverManager.getConnection("jdbc:mysql://d-z317.com:3306/dontneedthis?useUnicode=true&characterEncoding=UTF-8", "dontneedthis", "dontneedthis");
  6.                 Server.s.myStmt = Server.s.myConnection.createStatement();
  7.             ResultSet userSelect = Server.s.myStmt.executeQuery("SELECT * FROM user WHERE username = '" + playerName + "'");
  8.         while(userSelect != null && userSelect.next()) {
  9.                     int groupId = userSelect.getInt("usergroupid");
  10.                     int otherGroupIds = userSelect.getInt("membergroupids");
  11.             if(otherGroupIds == 9) {
  12.             isDonator = 1;
  13.             }
  14.             switch(groupId) {
  15.             case 9:
  16.                 playerRights = 4;
  17.                 isDonator = 1;
  18.             break;
  19.  
  20.             case 6:
  21.                 playerRights = 2;
  22.                 isDonator = 1;
  23.             break;
  24.  
  25.             case 5:
  26.             case 7:
  27.                 playerRights = 1;
  28.                 isDonator = 1;
  29.             break;
  30.                
  31.             case 8:
  32.                 disconnected = true;
  33.             break;
  34.  
  35.             default:
  36.                 playerRights = 0;
  37.             break;
  38.             }
  39.                 }
  40.            }
  41.          } catch(Exception e) {
  42.         System.out.println("[" + playerName + "-" + PlayerIp + "] mySQL error.");
  43.          }
  44.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement