예제 #1
0
        //注册用户
        public void RegUser(HttpContext context)
        {
            string RegType  = HttpContext.Current.Request.Form["RegType"];
            string values   = HttpContext.Current.Request.Form["values"];
            string pwd      = HttpContext.Current.Request.Form["pwd"];
            string neckName = HttpContext.Current.Request.Form["neckName"];
            string sex      = HttpContext.Current.Request.Form["sex"];
            string yzm      = HttpContext.Current.Request.Form["yzm"];

            show_userBll bll = new show_userBll();

            //如果是邮箱注册
            if (RegType == "1")
            {
                //发送邮件
                string code = bll.GetCode(values);
                if (code != "")
                {
                    //发送邮件
                    f.SendEmail(values, code, 0);
                    context.Response.Write("{\"status\":\"1\"}");
                    return;
                }
            }

            if (bll.CheckUserName(values))
            {
                context.Response.Write("{\"status\":\"用户名重复!\"}");
                return;
            }

            //获取验证码
            string dbyzm = bll.GetCode(values);

            if (RegType == "0")
            {
                if (dbyzm != yzm)
                {
                    context.Response.Write("{\"status\":\"验证码不正确!\"}");
                    return;
                }
            }

            bll.AddUserName(values, pwd, int.Parse(RegType), sex, neckName, values);
            HttpContext.Current.Session["UserName"] = values;
            if (RegType == "0")
            {
                context.Response.Write("{\"status\":\"0\"}");
            }
            else
            {
                //发送邮件
                string code = Guid.NewGuid().ToString();
                f.SendEmail(values, code, 0);
                context.Response.Write("{\"status\":\"1\"}");
            }
        }
예제 #2
0
        /// <summary>
        /// 手机重置密码 -1为验证码不正确 -2为手机验证码不正确 -3为验证码过期
        /// </summary>
        /// <param name="context"></param>
        public void SetPwd_phone(HttpContext context)
        {
            string       userName  = HttpContext.Current.Request.Form["UserName"];
            string       phoneCode = HttpContext.Current.Request.Form["phoneCode"];
            string       code      = HttpContext.Current.Request.Form["code"];
            show_userBll bll       = new show_userBll();

            //是否由此用户名
            if (!bll.CheckUserNname(userName))
            {
                context.Response.Write("{\"status\":\"-4\"}");
                return;
            }

            if (HttpContext.Current.Session["code"] == null)
            {
                context.Response.Write("{\"status\":\"-3\"}");
                return;
            }
            if (code != HttpContext.Current.Session["code"].ToString())
            {
                context.Response.Write("{\"status\":\"-1\"}");
                return;
            }

            //获取验证码
            string dbyzm = bll.GetCode(userName);

            if (dbyzm != phoneCode)
            {
                context.Response.Write("{\"status\":\"-2\"}");
                return;
            }
            context.Response.Write("{\"status\":\"0\"}");
        }
예제 #3
0
        /// <summary>
        /// 设置密码
        /// </summary>
        /// <param name="context"></param>
        public void ResPwd(HttpContext context)
        {
            string       userName  = HttpContext.Current.Request.Form["UserName"];
            string       phoneCode = HttpContext.Current.Request.Form["phoneCode"];
            string       code      = HttpContext.Current.Request.Form["code"];
            show_userBll bll       = new show_userBll();

            //是否由此用户名
            if (!bll.CheckUserNname(userName))
            {
                context.Response.Write("{\"status\":\"-4\"}");
                return;
            }
            //获取验证码
            string dbyzm = bll.GetCode(userName);

            if (dbyzm != phoneCode)
            {
                context.Response.Write("{\"status\":\"-2\"}");
                return;
            }
            string pwd = HttpContext.Current.Request.Form["pwd"];

            bll.UpdatePwd(userName, pwd);
            context.Response.Write("{\"status\":\"0\"}");
        }