Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- } else if (splitted[0].equalsIgnoreCase("!newacc")) {
- if (splitted.length < 4) {
- mc.dropMessage("!newacc <id> <name> <password> <email>");
- } else {
- try {
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("INSERT INTO account (id, name, password, email) VALUES (?, ?, ?, ?)");
- ps.setInt(1, splitted[1]); // id has auto increment, so it's not used.
- ps.setString(2, splitted[2]); // account name.
- ps.setString(3, LoginCrypto.hexSha1(splitted[3]));
- ps.setString(4, splitted[4]); // email.
- ps.executeUpdate();
- ps.close();
- mc.dropMessage("Account creation sucess. Username: " + splitted[2] + ". Password: " + splitted[3] + ".");
- } catch (SQLException e) {
- mc.dropMessage("Error creating a new account, Please read Batch Errors for more information");
- }
- }
- }
Add Comment
Please, Sign In to add comment