Advertisement
Guest User

Untitled

a guest
Oct 29th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. tCredential credential = new Classes.tCredential();
  2. credential.Username = txtSqlUserName.Text;
  3. credential.Password = txtSqlPassword.Password;
  4.  
  5. MySqlConnection conDataBase = new MySqlConnection(dbConnection);
  6. MySqlCommand SelectCommand = new MySqlCommand("select * from a3bans.admins where Username = '" + credential.Username + "'and Password= '" + credential.Password + "' ;", conDataBase);
  7. MySqlDataReader myReader;
  8. try
  9. {
  10. conDataBase.Open();
  11. myReader = SelectCommand.ExecuteReader();
  12. int count = 0;
  13. while (myReader.Read())
  14. {
  15. count = count + 1;
  16. }
  17. if (count == 1)
  18. {
  19. response.AuthenticationSuccess = true;
  20. }
  21. else if (count > 1)
  22. {
  23. response.AuthenticationSuccess = false;
  24. response.Message = "Duplicate Username and Password!";
  25. }
  26. else
  27. {
  28. response.AuthenticationSuccess = false;
  29. response.Message = "Incorrect Username or Password!";
  30. }
  31. }
  32. catch (Exception ex)
  33. {
  34.  
  35. }
  36. finally
  37. {
  38. conDataBase.Close();
  39. }
  40.  
  41. return response;
  42. }
  43.  
  44. tBan submit = new Classes.tBan();
  45. submit.GuidOrIP = txtID.Text;
  46. submit.BanType = cmbBanType.Text;
  47. submit.BanTime = txtBan.Text;
  48. submit.BanReason = txtReason.Text;
  49. submit.Proof = txtProof.Text;
  50.  
  51. string Query = "insert into a3bans.bans (GUID, BanTime, Reason, Proof, BanType) Values('" + ban.GuidOrIP + "','" + ban.BanTime + "','" + ban.BanReason + "','" + ban.Proof + "','" + ban.BanType + "') ;";
  52. MySqlConnection conDataBase = new MySqlConnection(dbConnection);
  53. connection object.
  54. MySqlCommand selectCommand = new MySqlCommand(Query, conDataBase);
  55. MySqlDataReader myReader;
  56. conDataBase.Open();
  57. myReader = selectCommand.ExecuteReader();
  58. while (myReader.Read())
  59. {
  60.  
  61. }
  62. conDataBase.Close();
  63. }
  64. catch (Exception ex)
  65. {
  66.  
  67. }
  68.  
  69. return "Ban Submitted!!";
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement