protected void check(object sender, EventArgs e)
        {
            string stunumStr     = RegularExpressions.MyEncodeInputString(worknum.Value.Trim());
            string pwdStr        = RegularExpressions.MyEncodeInputString(pwd.Value.Trim());
            int    isStuNumExsit = BADL_User.IsStunumExsit(stunumStr) ? 0 : 1;//0:学号存在,1:学号不存在

            if (CheckNum.CheckUserNum(stunumStr, pwdStr))
            {
                Session["stuNum"] = stunumStr;
                string uname = BADL_User.GetUserName(stunumStr);
                string umail = BADL_User.GetUserMail(stunumStr);
                if (isStuNumExsit == 1)
                {
                    Response.Write("<script>alert('该学号未注册,请注册');self.location='register.aspx'</script>");
                }
                else if (isStuNumExsit == 0)
                {
                    HttpCookie cookies = new HttpCookie("getUser");
                    cookies.Value   = uname + "+" + umail;
                    cookies.Expires = System.DateTime.Now.AddDays(1);
                    Response.Cookies.Add(cookies);
                    Response.Redirect("resetPwd.aspx");
                }
            }
            else
            {
                Response.Write("<script>alert('验证失败,学号或上网密码错误')</script>");
            }
        }
Beispiel #2
0
        public static string uNumPost(string uNum)
        {
            string UNum = RegularExpressions.MyEncodeInputString(uNum.Trim());

            if (!BADL_User.IsStunumExsit(UNum))
            {
                return("0");
            }
            else
            {
                return("1");//学号存在
            }
        }
Beispiel #3
0
        protected void uRegister(object sender, EventArgs e)
        {
            string unum    = RegularExpressions.MyEncodeInputString(uNum.Value.Trim());
            string unumpwd = RegularExpressions.MyEncodeInputString(uNumPwd.Value.Trim());
            string uname   = RegularExpressions.MyEncodeInputString(uName.Value.Trim());
            string upwd    = RegularExpressions.MyEncodeInputString(pwd.Value.Trim());
            string upwd1   = RegularExpressions.MyEncodeInputString(pwd1.Value.Trim());
            string umail   = RegularExpressions.MyEncodeInputString(uMail.Value.Trim());
            string ucheck  = RegularExpressions.MyEncodeInputString(uCheck.Value.Trim());
            string check   = HttpContext.Current.Session["check"].ToString();

            if (HttpContext.Current.Session["check"] == null)//判断验证码
            {
                Response.Write("<script>alert('验证码生成错误')</script>");
            }
            else if (!CheckNum.CheckUserNum(unum, unumpwd))
            {
                Response.Write("<script>alert('学号或上网密码错误')</script>");
            }
            else if (!upwd.Equals(upwd1))
            {
                Response.Write("<script>alert('密码不一致')</script>");
            }
            else if (!check.ToUpper().Equals(ucheck.ToUpper()))
            {
                Response.Write("<script>alert('验证码输入错误')</script>");
            }
            else
            {
                En_User eu = new En_User();
                eu.UNum         = unum;
                eu.UName        = uname;
                eu.UPwd         = Md5.MD5_encrypt(upwd1);
                eu.UMail        = umail;
                eu.RegisterTime = DateTime.Now;
                eu.LastLogin    = DateTime.Now;
                eu.State        = 0;

                int blank = BADL_User.IsBlankReg(eu);//判断字段长度
                if (blank != 5)
                {
                    Response.Write("<script>alert('字段长度不符')</script>");
                }
                else if (BADL_User.IsStunumExsit(unum))
                {
                    Response.Write("<script>alert('学号存在')</script>");
                }
                else if (BADL_User.IsNameExsit(uname))
                {
                    Response.Write("<script>alert('昵称存在')</script>");
                }
                else if (BADL_User.InsertUser(eu))
                {
                    Response.Redirect("login.aspx");//注册成功,跳转到登录界面
                }
                else
                {
                    Response.Write("<script>alert('注册异常')</script>");
                }
            }
        }