Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.Connection;
- import java.sql.SQLException;
- import com.mysql.jdbc.Statement;
- public class vote {
- public static void checkAuth(String authCode) throws SQLException {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- } catch (ClassNotFoundException e) {
- System.out.println("Where is your MySQL JDBC Driver?");
- e.printStackTrace();
- return;
- }
- Connection connection = null;
- Statement stmt = null;
- try {
- connection = DriverManager
- .getConnection("jdbc:mysql://cpanel.blazingfast.io:3306/elveron_voting","elveron_voting", "elveronvoting");
- } catch (SQLException e) {
- System.out.println("Connection Failed! Check output console");
- e.printStackTrace();
- return;
- }
- if (connection != null) {
- stmt = (Statement) connection.createStatement();
- String sql;
- sql = "SELECT id FROM claim WHERE status='" +authCode+ "'";
- ResultSet rs = stmt.executeQuery(sql);
- while(rs.next()){
- int id = rs.getInt("id");
- switch(id) {
- case 1:
- //give 500k gold
- break;
- case 2:
- //20k ecto tokens
- break;
- case 3:
- //15 spins
- break;
- case 4:
- //100 vote points
- break;
- case 5:
- //mystery box
- break;
- case 6:
- //prized pendant
- break;
- }
- }
- sql = "DELETE FROM claim WHERE status='" +authCode+ "'";
- stmt.execute(sql);
- rs.close();
- stmt.close();
- connection.close();
- } else {
- System.out.println("Failed to make connection!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement