예제 #1
0
        private void GetSafetyQuestion()
        {
            ClassLibrary.BLL.Member bll = new ClassLibrary.BLL.Member();

            List <ClassLibrary.Model.Member> list = bll.GetModelList("UserName='******'");

            if (list.Count == 0)
            {
                Response.Write("<script>alert('用户名不存在,请重新输入。。。');location.href='/forgetpwd/';</script>");
            }
            else
            {
                safetyQuestion = list[0].SafetyQuestion;
            }
        }
예제 #2
0
        private void ResetPassword(HttpContext context)
        {
            string id = context.Request.QueryString["id"];

            ClassLibrary.BLL.Member mber = new ClassLibrary.BLL.Member();

            if (mber.Updates("Password = '******'", "id = " + id) > 0)
            {
                Print(context, "success");
            }
            else
            {
                Print(context, "errors");
            }
        }
예제 #3
0
        private void MemberDelete(HttpContext context)
        {
            string id = context.Request.QueryString["id"];

            ClassLibrary.BLL.Member memberBLL = new ClassLibrary.BLL.Member();

            if (memberBLL.Delete(int.Parse(id)) > 0)
            {
                Print(context, "success");
            }
            else
            {
                Print(context, "errors");
            }
        }
예제 #4
0
        //注册
        private void AddUser()
        {
            ClassLibrary.BLL.Member   bll   = new ClassLibrary.BLL.Member();
            ClassLibrary.Model.Member model = new ClassLibrary.Model.Member();

            model.UserName       = HttpUtility.HtmlEncode(Function.GetFormString("UserName"));
            model.Password       = Function.MD5(Function.GetFormString("Password"));
            model.Nickname       = HttpUtility.HtmlEncode(Function.GetFormString("Nickname"));
            model.Telphone       = HttpUtility.HtmlEncode(Function.GetFormString("Telphone"));
            model.QQ             = HttpUtility.HtmlEncode(Function.GetFormString("QQ"));
            model.SafetyQuestion = HttpUtility.HtmlEncode(Function.GetFormString("SafetyQuestion"));
            model.SafetyAnswer   = HttpUtility.HtmlEncode(Function.GetFormString("SafetyAnswer"));
            model.CreatedTime    = DateTime.Now;

            if (string.IsNullOrEmpty(model.UserName))
            {
                Response.Write("<script>alert('资料填写不完整,请重新输入。');location.href='/register/';</script>");
            }
            else
            {
                if (Session["ValidateCode"] == null)
                {
                    Response.Write("<script>alert('验证码输入错误,请重新输入。');login.href='/register/';</script>");
                }
                else if (Request.Form["code"] != Session["ValidateCode"].ToString())
                {
                    Response.Write("<script>alert('验证码输入错误,请重新输入。');history.back(-1);</script>");
                }
                else
                {
                    if (bll.GetModelList("UserName='******'").Count > 0)
                    {
                        Response.Write("<script>alert('您输入的Email地址已被注册,请重新输入。');history.back(-1);</script>");
                    }
                    else
                    {
                        if (bll.Add(model) > 0)
                        {
                            Response.Write("<script>alert('恭喜您,注册成功!请登录。。。');location.href='/login/';</script>");
                        }
                        else
                        {
                            Response.Write("<script>alert('注册失败,您输入的数据有误,请重试。');location.href='/register/';</script>");
                        }
                    }
                }
            }
        }
예제 #5
0
        private void UserLogin()
        {
            string userName = HttpUtility.HtmlEncode(Function.GetFormString("UserName"));
            string password = Function.GetFormString("Password");

            string script = string.Empty;

            if (Function.IsNull(userName) || Function.IsNull(password))
            {
                script = "<script>alert('用户名和密码不能为空。');history.back(-1);</script>";
            }
            else if (Session["ValidateCode"] == null)
            {
                script = "<script>alert('验证码输入错误,请重新输入。');login.href='/login/';</script>";
            }
            else if (Request.Form["code"] != Session["ValidateCode"].ToString())
            {
                script = "<script>alert('验证码输入错误,请重新输入。');history.back(-1);</script>";
            }
            else
            {
                ClassLibrary.BLL.Member bll = new ClassLibrary.BLL.Member();
                DataTable myTable           = bll.UserLogin(userName, Function.MD5(password));

                if (myTable.Rows.Count == 0)
                {
                    script = "<script>alert('用户名或密码输入有误,请重新输入。');location.href='/login/';</script>";
                }
                else
                {
                    UserInfo u = new UserInfo(CookieName.MemberInfo);

                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add(LoginInfo.ID.ToString(), myTable.Rows[0]["ID"].ToString());
                    dic.Add(LoginInfo.UserName.ToString(), myTable.Rows[0]["UserName"].ToString());
                    dic.Add(LoginInfo.Nickname.ToString(), myTable.Rows[0]["Nickname"].ToString());
                    u.CreatedCookie(dic);

                    script = "<script>location.href='/vip/info/';</script>";
                }
            }

            Response.Write(script);
        }