Advertisement
Guest User

Untitled

a guest
May 28th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionStringRegga"].ConnectionString);
  2. con.Open();
  3. string checkUser = "select count(*)from Regga where Anvandare='" + UserBox.Text + "'";
  4. SqlCommand com = new SqlCommand(checkUser, con);
  5. int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
  6. con.Close();
  7. if (temp == 1)
  8. {
  9. con.Open();
  10. string checkPasswordQuery = "select Losenord from Regga where Anvandare='" + UserBox.Text + "'";
  11. SqlCommand passCom = new SqlCommand(checkPasswordQuery, con);
  12. string password = passCom.ExecuteScalar().ToString().Replace(" ","");
  13. if (password == PassBox.Text)
  14. {
  15. Session["New"] = UserBox.Text;
  16. Response.Redirect("MinSida.aspx");
  17.  
  18. }
  19. else
  20. {
  21. Response.Write("Fel lösenord");
  22.  
  23. }
  24. con.Close();
  25. }
  26. else
  27. {
  28. Response.Write("Fel användarnamn");
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement