Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public CreateUser() {
- initComponents();
- passwordE = jPasswordField1.getPassword().toString();
- }
- public void createUser(){
- if (!jTextField1.getText().equals("") && !jPasswordField2.getPassword().toString().equals("") &&
- !jPasswordField1.getPassword().toString().equals("")){
- if (jPasswordField2.getPassword().toString().equals(jPasswordField1.getPassword().toString())) {
- try{
- con = DriverManager.getConnection(url+dbName,userName,password);
- System.out.println("Connected to the database");
- PreparedStatement pst = con.prepareStatement("INSERT INTO accounts (username, accessLevel, userPassword) VALUES (?,?,AES_ENCRYPT('"+passwordE+"','enigma'))");
- pst.setString(1, jTextField1.getText());
- pst.setInt(2, accessLevel);
- pst.executeQuery();
- con.close();
- System.out.println("Disconnected from database");
- new CreateUserConfirm().setVisible(true);
- this.dispose();
- } catch (SQLException e) {System.err.println("ERROR: " + e.getMessage()); }
- }else new CreateUserEmpty().setVisible(true);
- this.dispose();
- }else new CreateUserEmpty().setVisible(true);
- this.dispose();
- }
Add Comment
Please, Sign In to add comment