コード例 #1
0
ファイル: Accounts.java プロジェクト: fozgee/crossword
  // create account (account name, account password, account email)
  public boolean CreateAccount(Account a) throws NoSuchAlgorithmException {
    String name = a.getAccountName();

    if (!CheckUserExist(name)) {
      String pass = new MD5().createMD5(a.getAccountPassword());
      String email = a.getAccountMail();
      int type = 2;
      String cmd2 =
          "insert into Account values('" + name + "','" + pass + "','" + email + "'," + type + ")";
      boolean result = new SQLUtil().execute(cmd2);
      if (result) {
        JOptionPane.showMessageDialog(Accounts, "Register Successfully");
        return true;
      } else {
        JOptionPane.showMessageDialog(Accounts, "Create Account faild");
        return false;
      }

    } else {
      JOptionPane.showMessageDialog(Accounts, "Username already exist");
      return false;
    }
  }