Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (playerCommand.startsWith("auth") && playerCommand.length() > 5) {
- //if (!Config.MYSQL_ACTIVE) {
- // c.sendMessage("Sorry this is currently disabled.");
- // return;
- //} else {
- try {
- //PreparedStatement ps =
- java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://zionscape.com:3306/zionscap_vote", "zionscap_votsusr", "livinlarge12");
- PreparedStatement ps = con
- .prepareStatement(
- "SELECT * FROM votes WHERE username = ? AND used = '1' LIMIT 1");
- ps.setString(1, c.playerName);
- ResultSet results = ps.executeQuery();
- if (results.next()) {
- c.sendMessage("You have already voted once today.");
- } else {
- ps.close();
- ps = con
- .prepareStatement(
- "SELECT * FROM votes WHERE authcode = ? AND used = '0' LIMIT 1");
- ps.setString(1, playerCommand.substring(5));
- results = ps.executeQuery();
- if (results.next()) {
- ps.close();
- ps = con.prepareStatement(
- "UPDATE votes SET used = '1' WHERE authcode = ?");
- ps.setString(1, playerCommand.substring(5));
- ps.executeUpdate();
- c.votePoints += 1;
- c.sendMessage("Thank you for voting.");
- c.sendMessage("You now have @red@" + c.votePoints
- + "@bla@ vote points");
- } else {
- c.sendMessage("The auth code is not valid!");
- }
- }
- ps.close();//what about that ps? this code is ugly n 'shit ol
- } catch (Exception e) {
- e.printStackTrace();
- }
- return;
- }
Add Comment
Please, Sign In to add comment