SHARE
TWEET

Untitled

a guest Dec 13th, 2016 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. protected void loginButton_Click(object sender, EventArgs e)
  2.     {
  3.         SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["newregDBConnectionString"].ConnectionString);
  4.         conn.Open();
  5.         string checkUser = "select count(*) from parent where parentID='" + userText.Text + "'";
  6.         SqlCommand com = new SqlCommand(checkUser, conn);
  7.         int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
  8.         conn.Close();            
  9.             if (temp == 1)
  10.             {
  11.                 conn.Open();
  12.                 string checkPassword = "select password from parent where password='" + passText.Text + "'";
  13.                 SqlCommand passCom = new SqlCommand(checkPassword, conn);
  14.                 var obj = passCom.ExecuteScalar();
  15.                 string password = obj?.ToString().Trim();
  16.                 if (password == passText.Text)
  17.                 {
  18.                     Session["New"] = userText.Text;
  19.                     Response.Write("<script>alert('Details are correct, welcome');</script>");
  20.                     Response.Redirect("Payment.aspx");
  21.                 }
  22.                 else
  23.                 {
  24.                     Response.Write("<script>alert('Details are incorrect, please try again');</script>");
  25.                     userText.Text = "";
  26.                     passText.Text = "";
  27.                 }
  28.             }
  29.             else
  30.             {
  31.                 Response.Write("<script>alert('Details are incorrect, please try again');</script>");
  32.                 userText.Text = "";
  33.                 passText.Text = "";
  34.             }
  35.             conn.Close();
  36.         }
  37.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top