Beispiel #1
0
    protected void btnRegester_Click(object sender, EventArgs e)
    {
        if (Session["Vnum"].ToString() != txtValidator.Text.Trim())
        {
            Response.Write("<script>alert('登录失败,请检查验证码!')</script>");
            return;
        }
        else if (!RegularExpressionValidator_Email.IsValid && !RegularExpressionValidator_phone.IsValid && !CompareValidator_Pwd.IsValid)    //是否通过验证控件的判断
        {
            Response.Write("<script>alert('注册失败请正确填写信息!')</script>");
            return;
        }
        else
        {
            if (Register(txtUsername.Text.Trim(), txtPassword1.Text.Trim(), txtEmail.Text.Trim(), txtPhone.Text.Trim()) != 1)
            {
                Response.Write("<script>alert('注册失败请正确填写信息!')</script>");
                return;
            }
            else
            {
                class_Operate inputCookies = new class_Operate();

                int xx = inputCookies.WriteCookies(qq, txtUsername.Text.Trim(), txtPassword1.Text.Trim(), "~/img/userHead/base.png"); //Cookies 发送到客户端

                Session["isFirst"] = "1";                                                                                             //标志第一次登陆,用来判定是否可以进入到regsuccess界面,只有第一次可以进去,其他的资料修改专门有修改页面

                Response.Write("<script language='javascript'>window.alert('注册成功" + xx.ToString() + "session" + Session["isFirst"].ToString() + "');window.location='regsuccess.aspx'</script>");
            }
        }
    }
Beispiel #2
0
    protected void btnInfoSub_Click(object sender, EventArgs e)
    {
        string userSex      = ddlSex.SelectedValue;
        string userNike     = txtUserNike.Text;
        string userBirthday = txtBirthday.Text;
        string userQQ       = Request.Cookies["userQQ"].Value;
        string usersign     = txtSign.Text;

        if (updateInfo(userNike, userSex, userBirthday, usersign, userQQ) == 0)
        {
            Response.Write("<script>window.alert('修改失败!');location.href='editInfo.aspx';</script>");  //如果失败跳转到资料更改页面
        }
        else
        {
            class_Operate inputcookie = new class_Operate();
            inputcookie.WriteCookies(userQQ, userNike, "", "");
            Response.Write("<script>window.alert('修改成功!');location.href='home.aspx';</script>");
        }
    }
Beispiel #3
0
    private bool writCookies(string Uqq, string Upwd)
    {
        string    sql = "select Unick,Uheadimg from Users where Uqq='" + Uqq + "'";
        DataTable dt  = class_Operate.SelectT(sql);

        if (dt.Rows.Count > 0)
        {
            string        unike        = dt.Rows[0][0].ToString();
            string        uimgpath     = dt.Rows[0][1].ToString();
            class_Operate inputCookies = new class_Operate();
            if (inputCookies.WriteCookies(Uqq, unike, Upwd, uimgpath) == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        else
        {
            return(false);
        }
    }