protected void BtnRegister_Click(object sender, EventArgs e) { if (CCode == TxtCaptcha.Text) { string MyCommand1, Gender = " ", EncryptedPasswd, connection; if (Rdbcng.Checked == true) { connection = "cng"; } else { connection = "png"; } if (RdbMale.Checked == true) { Gender = "Male"; } else { Gender = "Female"; } EncryptedPasswd = em.EncryptedCode(TxtPwd.Text); MyCommand1 = "insert into registration1 values('" + connection + "','" + TxtName.Text + "','" + Gender + "','" + TxtMob.Text + "','" + TxtEmail.Text + "','" + TxtAdd.Text + "','" + FileUpload.FileName + "', '" + EncryptedPasswd + "','" + DateTime.Now.ToString() + "')"; string MyCommand2 = "insert into TblLogin values('" + TxtEmail.Text + "','" + EncryptedPasswd + "',1,0,'')"; bool x = dm.ExecuteInsertUpdateOrDelete(MyCommand1); if (x == true) { if (dm.ExecuteInsertUpdateOrDelete(MyCommand2) == true) { FileUpload.SaveAs(Server.MapPath("~/UserPics/" + FileUpload.FileName)); Response.Write("<script>alert('Your Registration is Successfully Completed.')</script>"); } else { Response.Write("<script>alert('Your registration not successfull......Please Try Again!')</script>"); } } else { Response.Write("<script>alert('Your registration not successfull......Please Try Again!')</script>"); } } else { Response.Write("<script>alert('Invalid Captcha..!')</script>"); } }
protected void BtnLogin_Click(object sender, EventArgs e) { string EncryptedPass = em.EncryptedCode(TxtPass.Text); string command = "select * from TblLogin where User_ID='" + TxtEmail.Text + "'and Passwd='" + EncryptedPass + "'"; System.Data.DataTable dt = dm.ExecuteSelect(command); if (dt.Rows.Count > 0) { string cmd = "update TblLogin set LCount=(LCount+1),LoginTime='" + DateTime.Now.ToString() + "' where User_ID='" + TxtEmail.Text + "' and Passwd='" + EncryptedPass + "' and Status=true"; bool x = dm.ExecuteInsertUpdateOrDelete(cmd); Session["userid"] = TxtEmail.Text; Response.Redirect("~/Consumer_Zone/Home.aspx"); } else { Response.Write("<script>alert('Invalid User ID OR Password!!!')<script>"); } }