protected void Page_Load(object sender, EventArgs e) { if ((int)Session["fails"] >= 3) { Response.Redirect("ForgotPass.aspx"); } else if (Session["email"] != null) { Response.Redirect("HomePage.aspx"); } else if (Request.Form["submit"] != null) { if (MyADOHelper.Authentication(Request.Form["email"], Request.Form["password"])) { ClientScript.RegisterStartupScript(GetType(), "Login Error", "loginVerification(true);", true); Session["email"] = Request.Form["email"]; Session["isAdmin"] = MyADOHelper.ShowIsAdmin(Session["email"].ToString()); Session["username"] = MyADOHelper.Select(Session["email"].ToString(), "username"); Response.Redirect("HomePage.aspx"); } else { Session["fails"] = (int)Session["fails"] + 1; ClientScript.RegisterStartupScript(GetType(), "Login Error", "loginVerification(false);", true); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["email"] == null) { Response.Redirect("HomePage.aspx"); } else if (Request.Form["submit"] != null) { MyADOHelper.Update(Session["email"].ToString(), "username", Request.Form["username"]); MyADOHelper.Update(Session["email"].ToString(), "firstname", Request.Form["finame"]); MyADOHelper.Update(Session["email"].ToString(), "lastname", Request.Form["laname"]); MyADOHelper.Update(Session["email"].ToString(), "password", Request.Form["passmake"]); MyADOHelper.Update(Session["email"].ToString(), "bdate", Request.Form["bdate"]); MyADOHelper.Update(Session["email"].ToString(), "country", Request.Form["country"]); } else { Session["username"] = MyADOHelper.Select(Session["email"].ToString(), "username"); Session["finame"] = MyADOHelper.Select(Session["email"].ToString(), "firstname"); Session["laname"] = MyADOHelper.Select(Session["email"].ToString(), "lastname"); Session["password"] = MyADOHelper.Select(Session["email"].ToString(), "password"); Session[MyADOHelper.Select(Session["email"].ToString(), "gender").ToString()] = "checked"; Session["country"] = MyADOHelper.Select(Session["email"].ToString(), "country"); string bdate = MyADOHelper.Select(Session["email"].ToString(), "bdate").ToString(); bdate = bdate.Remove(bdate.LastIndexOf('/') + 5); string newstr = ""; string[] arr = new string[3]; arr = bdate.Split('/'); for (int i = 0; i < arr.Length; i++) { if (arr[i].Length < 2) { string num = arr[i]; arr[i] = "0" + num; } } newstr += arr[2] + '-'; newstr += arr[1] + '-'; newstr += arr[0]; Session["bdate"] = newstr; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["email"] != null) { Response.Redirect("HomePage.aspx"); } if (Request.Form["submit"] != null) { if (MyADOHelper.IsRightAnswer(Session["changePassEmail"].ToString(), Request.Form["secureVeri"])) { ClientScript.RegisterStartupScript(GetType(), "Security Error Message", "securityQuestVeri(true);", true); MyADOHelper.Update(Session["changePassEmail"].ToString(), "password", Request.Form["passmake"]); Session["fails"] = 0; Response.Redirect("SignIn.aspx"); } else { ClientScript.RegisterStartupScript(GetType(), "Security Error Message", "securityQuestVeri(false);", true); } } if (Request.QueryString["v"] != null && Request.QueryString["m"] != null && Session["v"] != null && Session["changePassEmail"] != null) { if (Session["changePassEmail"].ToString() == Request.QueryString["m"] && (int)Session["v"] == int.Parse(Request.QueryString["v"])) { char securityQuestion = char.Parse((MyADOHelper.Select(Session["changePassEmail"].ToString(), "securequest").ToString()).Replace(" ", String.Empty)); switch (securityQuestion) { case 'p': Session["secQuest"] = "What's your pet name?"; break; case 'f': Session["secQuest"] = "What's your best friend name?"; break; case 'l': Session["secQuest"] = "Where do you live?"; break; case 'm': Session["secQuest"] = "What's your mother's last name before she merried?"; break; case 's': Session["secQuest"] = "What's the name of the first school you were in?"; break; default: Session["secQuest"] = "wtf"; break; } } else { Response.Redirect("HomePage.aspx"); } } else { Response.Redirect("HomePage.aspx"); } }