コード例 #1
0
    protected void btnReg_Click(object sender, EventArgs e)
    {
        int selCntFirst = Convert.ToInt32(db.selDB("select count(*) ID from register where userName='******'"));

        if (fl == true)
        {
            Response.Write("<script>alert('*请选择性别');</script>");
        }
        else
        {
            if (flag == true)
            {
                nan = "男";
                fll = true;
            }
            if (flag == false)
            {
                nan = "女";
                fll = true;
            }
        }
        if (fll == true && CompareValidator1.IsValid == true && rfvConPassWord.IsValid == true)
        {
            string psd = FormsAuthentication.HashPasswordForStoringInConfigFile(userPassWord.Text, "MD5");
            db.updateQuery("insert into register(userName,userSex,userBorn,userPhone,userMail,userQQ,userPassWord,create_date) values('" + userName.Text + "','" + nan + "','" + tbBorn.Text.ToString() + "','" + tbPhone.Text + "','" + tbMail.Text + "','" + tbTencent.Text + "','" + psd + "','" + DateTime.Now.ToString() + "')");
            Response.Write("<script>alert('用户注册成功!感谢您的加入!')</script>");
            Response.Write("<script language=javascript>javascript:location.href='Default.aspx'</script>");
            Response.Write("<script>alert('为了信息安全,请您手动输入信息登陆!')</script>");
            return;
        }
        else
        {
            Response.Write("<script>alert('注册失败!')</script>");
        }
    }