WebSite/LoginReg/UserReg.aspx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;

public partial class LoginReg_UserReg : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            btnReg.Attributes.Add("onclick", "return jsCheck();");
        }
    }
    protected void btnReg_Click(object sender, EventArgs e)
    {
        string codeValue = WebUtility.CheckStr(txtCodeNum.Text);
        if (Session["Code"] == null || Session["Code"].ToString() != codeValue)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", WebUtility.Alert("验证码出错!!"));
            return;
        }
        D_UserRegInfo userInfo = new D_UserRegInfo();
        userInfo.Username = WebUtility.CheckStr(txtUserName.Text);
        userInfo.Password = StringHelper.MD5String(WebUtility.CheckStr(txtPwd1.Text));
        userInfo.Age =0;
        userInfo.Sex =0;
        userInfo.HeadId = 0;
        userInfo.Country = "";
        userInfo.Email = WebUtility.CheckStr(txtEmail.Text);
        userInfo.Mobile ="";
        userInfo.Note ="";
        userInfo.Phone ="";
        userInfo.QQ = "";
        userInfo.Province ="";

        if (userInfo.Username == "" || userInfo.Password == "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", WebUtility.Alert("带*号项必须填写!!"));
            return;
        }
        D_User u = new D_User();
        string userId;
        userId=u.RegNewUser(userInfo);
        if (userId == "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", WebUtility.Alert("用户注册失败!!"));
            return;
        }
        else
        {
            Response.Redirect("UserLogin.aspx?UserId=" + userId, true);
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。