Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["email"] == null || !(bool)Session["isAdmin"])
     {
         Response.Redirect("HomePage.aspx");
     }
     if (Request.Form["update"] != null)
     {
         for (int i = 0; Request.Form["" + i] != null; i++)
         {
             if (Request.Form["" + i].ToString()[0] == '@')
             {
                 MyADOHelper.Update(Request.Form["" + i].ToString().Remove(0, 1), "isAdmin", false);
             }
             else
             {
                 MyADOHelper.Update(Request.Form["" + i].ToString().Remove(Request.Form["" + i].ToString().LastIndexOf(',')), "isAdmin", true);
             }
         }
         for (int i = 0; Request.Form["o" + i] != null; i++)
         {
             if (Request.Form["o" + i] != null)
             {
                 //Remove user's files and then user's details
                 using (SqlConnection cn = new SqlConnection(gone))
                 {
                     SqlCommand cmd = new SqlCommand("removeUser", cn);
                     cmd.CommandType = CommandType.StoredProcedure;
                     cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value = Request.Form["o" + i].ToString();
                     cn.Open();
                     cmd.ExecuteNonQuery();
                     cn.Close();
                 }
                 MyADOHelper.Delete(Request.Form["o" + i].ToString());
                 if (Session["email"].ToString() == Request.Form["o" + i].ToString())
                 {
                     Session.Abandon();
                 }
             }
         }
     }
 }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
        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");
            }
        }