protected void btnlogin_Click(object sender, ImageClickEventArgs e) { DBManager dm = new DBManager(); EnCryptionManager em = new EnCryptionManager(); string epass = em.encryptmydata(txtpass.Text); string cmd = "Select *from Login where userid='" + txtUID.Text + "' and pass='******' and status=true"; DataTable dt = dm.ExecuteMySelect(cmd); if (dt.Rows.Count > 0) { cmd = "update Login set Lcount=(Lcount+1),LoginTime='" + DateTime.Now.ToString() + "' where userid='" + txtUID.Text + "' and pass='******'"; bool x = dm.ExecuteMyINsertUpdateOrDelete(cmd); if (x == true) { Session["userid"] = txtUID.Text; Response.Redirect("~/Consumer Zone/Home.aspx"); } else { Response.Write("<script>alert('Unable to login!');</script>"); } } else { Response.Write("<script>alert('Invalid UserID or Password.');</script>"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { string gender = ""; if (rdbmale.Checked == true) { gender = "male"; } else { gender = "female"; } if (txtcaptcha.Text == ccode) { DBManager dm = new DBManager(); string code = "select * from Login where UserID='" + txtEmail.Text + "' "; DataTable dt = dm.ExecuteMySelect(code); if (dt.Rows.Count > 0) { Response.Write("<script>alert('Email ID already REGISTERED!');</script>"); txtEmail.Text = ""; } else { string epass; EnCryptionManager em = new EnCryptionManager(); epass = em.encryptmydata(txtpass.Text); string mycommand = "Insert into Registration(ConType,UName,Gender,MobileNo,EmailId,Address,ProfilePic,Pass,RegDT,secquestion,secanswer) values('" + ddlcontype.SelectedValue + "','" + txtname.Text + "','" + gender + "','" + txtMoNo.Text + "','" + txtEmail.Text + "','" + txtaddress.Text + "','" + FuPicture.FileName + "','" + epass + "','" + DateTime.Now.ToString() + "','" + ddlsecurequest.SelectedValue + "','" + txtAnswer.Text + "')"; bool b = dm.ExecuteMyINsertUpdateOrDelete(mycommand); if (b == true) { mycommand = "Insert into Login values('" + txtEmail.Text + "','" + epass + "',1,0,'')"; b = dm.ExecuteMyINsertUpdateOrDelete(mycommand); if (b == true) { FuPicture.SaveAs(Server.MapPath("~/UserPics/" + FuPicture.FileName)); string cmd = "select CustomerId from Registration where EmailId='" + txtEmail.Text + "'"; DataTable d = dm.ExecuteMySelect(cmd); string s = d.Rows[0][0].ToString(); msgbox("You are registered successfully. Your Customer Id is: " + s + " Please note it successfully."); txtaddress.Text = ""; txtAnswer.Text = ""; txtcaptcha.Text = ""; txtconpass.Text = ""; txtEmail.Text = ""; txtMoNo.Text = ""; txtname.Text = ""; txtpass.Text = ""; } else { Response.Write("<script>alert('Your registration failed.')</script>"); } } } } }
protected void BtnChange_Click(object sender, EventArgs e) { EnCryptionManager em = new EnCryptionManager(); string ecurpass = em.encryptmydata(TxtCurPass.Text); string enewpass = em.encryptmydata(TxtNewPass.Text); string cmd = "Update Login set Pass='******' where userid='" + Session["Userid"].ToString() + "' and pass='******'"; DBManager dm = new DBManager(); bool x = dm.ExecuteMyINsertUpdateOrDelete(cmd); if (x == true) { Response.Write("<script>alert('Password updated successfiully.');</script>"); } else { Response.Write("<script>alert('Unable to update password. your current password in invalid.');</script>"); } }
protected void BtnChange_Click(object sender, EventArgs e) { DBManager dm = new DBManager(); EnCryptionManager em = new EnCryptionManager(); string OldPass = em.encryptmydata(TxtOldPass.Text); string newpass = em.encryptmydata(TxtNewPass.Text); string cm = "Update Login set Pass='******' where pass='******' and userid='" + Session["adminid"] + "'"; bool b = dm.ExecuteMyINsertUpdateOrDelete(cm); if (b == true) { Response.Write("<script>alert('Password updated successfiully.');</script>"); } else { Response.Write("<script>alert(' password not updated.');</script>"); } }