Beispiel #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            funs f = new funs();
            //String timeStamp = DateTime.Now.ToString("yyyyMMddHHmmss");
            //String img_name = timeStamp + files.FileName.ToString();
            ////files.SaveAs($"upload/{files.FileName}");
            //Response.Write("<script>alert('" + img_name + "');</script>");
            //files.SaveAs(Server.MapPath("~/upload/") + img_name);
            String a = f.TripleDesEncrypt("Hello");
            String b = f.TripleDesDecrypt(a);

            Response.Write("<script>alert('" + a + " = > " + b + "');</script>");
        }
Beispiel #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            String password  = pwd.Text;
            String cpassword = cpwd.Text;
            String uemail    = email.Text;

            if (password.Equals(cpassword))
            {
                funs   f           = new funs();
                String Hashed_pwd  = f.SHA_256_salted(password, uemail).ToString();
                String cHashed_pwd = f.SHA_256_salted(cpassword, uemail).ToString();
                if (Hashed_pwd.Equals(cHashed_pwd))
                {
                    UserProps u = new UserProps();
                    u.U_id           = u_id.Text;
                    u.U_name         = name.Text;
                    u.U_cnic         = cnic.Text;
                    u.U_cell         = cell.Text;
                    u.U_email        = uemail;
                    u.U_password     = Hashed_pwd;
                    u.U_address      = address.Text;
                    u.U_access_level = access_level.SelectedValue.ToString();
                    UserBLL ubbb = new UserBLL();
                    if (ubbb.insertUserBLL(u))
                    {
                        Session["U_access_level"] = u.U_access_level;
                        Session["U_id"]           = u.U_id;
                        Session["U_name"]         = u.U_name;
                        Response.Redirect("adduser.aspx?success=User Registered Successfull");
                    }
                    else
                    {
                        Response.Redirect("adduser.aspx?error=Something Went Wrong....!  User Registerion Unsuccessfull");
                    }
                }
                else
                {
                    Response.Redirect("adduser.aspx?error=Hash Doesn't Match.");
                }
            }
            else
            {
                Response.Redirect("adduser.aspx?error=Password Doesn't Match.");
            }
        }
Beispiel #3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (pwd.Text != null || pwd.Text != "")
     {
         if (pwd.Text == cpwd.Text)
         {
             funs   f     = new funs();
             String pass  = f.SHA_256_salted(pwd.Text, email.Text);
             String cpass = f.SHA_256_salted(cpwd.Text, email.Text);
             if (pass == cpass)
             {
                 UserProps u = new UserProps();
                 u.U_id           = u_id.Text;
                 u.U_name         = name.Text;
                 u.U_cnic         = cnic.Text;
                 u.U_cell         = cell.Text;
                 u.U_email        = email.Text;
                 u.U_password     = pass;
                 u.U_address      = address.Text;
                 u.U_access_level = access_level.SelectedValue.ToString();
                 UserBLL ubbb = new UserBLL();
                 if (ubbb.updateUserBLL(u))
                 {
                     Response.Redirect("edituser.aspx?success=User Updated Successfull");
                 }
                 else
                 {
                     Response.Redirect("edituser.aspx?error=Something Went Wrong....!");
                 }
             }
             else
             {
                 Response.Redirect("edituser.aspx?error=Hash Doesn't Match.");
             }
         }
         else
         {
             Response.Redirect("edituser.aspx?error=Password Doesn't Match.");
         }
     }
     else
     {
         UserProps u = new UserProps();
         u.U_id           = u_id.Text;
         u.U_name         = name.Text;
         u.U_cnic         = cnic.Text;
         u.U_cell         = cell.Text;
         u.U_email        = email.Text;
         u.U_password     = hdnpass.Text;
         u.U_address      = address.Text;
         u.U_access_level = access_level.SelectedValue.ToString();
         UserBLL ubbb = new UserBLL();
         if (ubbb.updateUserBLL(u))
         {
             Response.Redirect("edituser.aspx?success=User Updated Successfull");
         }
         else
         {
             Response.Redirect("edituser.aspx?error=Something Went Wrong....!");
         }
     }
 }