Esempio n. 1
0
    protected void OKButton_Click(object sender, ImageClickEventArgs e)
    {
        string password;
        string username;
        bool   flag      = false;
        string MdPswdStr = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.ToString(), "MD5");

        username = txtUserName.Text.ToString();
        password = MdPswdStr;
        if (username.Equals("") || password.Equals(""))
        {
            Response.Write("<script language=javascript>alert('用户名和密码不能为空!')</script>");
            return;
        }
        Function_Admin Function_Admin = new Function_Admin();
        DataTable      dt             = new DataTable();

        dt = Function_Admin.User_Login(3, username, password, "");
        if (dt.Rows.Count > 0)
        {
            Response.Write("<script language=javascript>alert('对不起,该用户已经注册!');location='Register.aspx'</script>");
            return;
        }
        else
        {
            Function_Admin.User_Login_insert(4, username, password, "");
            flag = true;
        }
        if (flag)
        {
            Response.Write("<script language=javascript>alert('注册用户成功!'); location='Index.aspx'</script>");
        }
    }
Esempio n. 2
0
    protected void OKButton_Click(object sender, ImageClickEventArgs e)
    {
        string    uid = Session["UserLoginName"].ToString();
        string    pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword_Old.Text.ToString(), "MD5");
        DataTable dt  = Function_Admin.User_Login(3, uid, pwd, "");

        if (dt == null || dt.Rows.Count <= 0)
        {
            Response.Write("<script language=javascript>alert('旧密码输入有误!')</script>");
            return;
        }
        else
        {
            string newpwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword_Confirm.Text.ToString(), "MD5");
            int    result = Function_Admin.User_Login_insert(5, uid, newpwd, "");
            if (result >= 1)
            {
                Response.Write("<script>alert('密码更新成功!');location='Index.aspx'</script>");
            }
        }
    }