Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tCredential credential = new Classes.tCredential();
- credential.Username = txtSqlUserName.Text;
- credential.Password = txtSqlPassword.Password;
- MySqlConnection conDataBase = new MySqlConnection(dbConnection);
- MySqlCommand SelectCommand = new MySqlCommand("select * from a3bans.admins where Username = '" + credential.Username + "'and Password= '" + credential.Password + "' ;", conDataBase);
- MySqlDataReader myReader;
- try
- {
- conDataBase.Open();
- myReader = SelectCommand.ExecuteReader();
- int count = 0;
- while (myReader.Read())
- {
- count = count + 1;
- }
- if (count == 1)
- {
- response.AuthenticationSuccess = true;
- }
- else if (count > 1)
- {
- response.AuthenticationSuccess = false;
- response.Message = "Duplicate Username and Password!";
- }
- else
- {
- response.AuthenticationSuccess = false;
- response.Message = "Incorrect Username or Password!";
- }
- }
- catch (Exception ex)
- {
- }
- finally
- {
- conDataBase.Close();
- }
- return response;
- }
- tBan submit = new Classes.tBan();
- submit.GuidOrIP = txtID.Text;
- submit.BanType = cmbBanType.Text;
- submit.BanTime = txtBan.Text;
- submit.BanReason = txtReason.Text;
- submit.Proof = txtProof.Text;
- string Query = "insert into a3bans.bans (GUID, BanTime, Reason, Proof, BanType) Values('" + ban.GuidOrIP + "','" + ban.BanTime + "','" + ban.BanReason + "','" + ban.Proof + "','" + ban.BanType + "') ;";
- MySqlConnection conDataBase = new MySqlConnection(dbConnection);
- connection object.
- MySqlCommand selectCommand = new MySqlCommand(Query, conDataBase);
- MySqlDataReader myReader;
- conDataBase.Open();
- myReader = selectCommand.ExecuteReader();
- while (myReader.Read())
- {
- }
- conDataBase.Close();
- }
- catch (Exception ex)
- {
- }
- return "Ban Submitted!!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement