Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void checkSQL() {
- try {
- if(Server.s.myConnection.isClosed() || !Server.s.myConnection.isClosed()) {
- Class.forName("org.gjt.mm.mysql.Driver");
- Server.s.myConnection = DriverManager.getConnection("jdbc:mysql://d-z317.com:3306/dontneedthis?useUnicode=true&characterEncoding=UTF-8", "dontneedthis", "dontneedthis");
- Server.s.myStmt = Server.s.myConnection.createStatement();
- ResultSet userSelect = Server.s.myStmt.executeQuery("SELECT * FROM user WHERE username = '" + playerName + "'");
- while(userSelect != null && userSelect.next()) {
- int groupId = userSelect.getInt("usergroupid");
- int otherGroupIds = userSelect.getInt("membergroupids");
- if(otherGroupIds == 9) {
- isDonator = 1;
- }
- switch(groupId) {
- case 9:
- playerRights = 4;
- isDonator = 1;
- break;
- case 6:
- playerRights = 2;
- isDonator = 1;
- break;
- case 5:
- case 7:
- playerRights = 1;
- isDonator = 1;
- break;
- case 8:
- disconnected = true;
- break;
- default:
- playerRights = 0;
- break;
- }
- }
- }
- } catch(Exception e) {
- System.out.println("[" + playerName + "-" + PlayerIp + "] mySQL error.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement