Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void loginButton_Click(object sender, EventArgs e)
- {
- SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["newregDBConnectionString"].ConnectionString);
- conn.Open();
- string checkUser = "select count(*) from parent where parentID='" + userText.Text + "'";
- SqlCommand com = new SqlCommand(checkUser, conn);
- int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
- conn.Close();
- if (temp == 1)
- {
- conn.Open();
- string checkPassword = "select password from parent where password='" + passText.Text + "'";
- SqlCommand passCom = new SqlCommand(checkPassword, conn);
- var obj = passCom.ExecuteScalar();
- string password = obj?.ToString().Trim();
- if (password == passText.Text)
- {
- Session["New"] = userText.Text;
- Response.Write("<script>alert('Details are correct, welcome');</script>");
- Response.Redirect("Payment.aspx");
- }
- else
- {
- Response.Write("<script>alert('Details are incorrect, please try again');</script>");
- userText.Text = "";
- passText.Text = "";
- }
- }
- else
- {
- Response.Write("<script>alert('Details are incorrect, please try again');</script>");
- userText.Text = "";
- passText.Text = "";
- }
- conn.Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement