コード例 #1
0
        private void ValidateOldPwd(HttpContext context)
        {
            string result = "ok";

            user_model = user_bll.GetModel(UserID_HongRenHui);

            if (user_model != null)
            {
                string pwd = String_Manage.Return_Request_Str("pwd");
                if (pwd == "")
                {
                    result = "noold";
                }
                else
                {
                    pwd = NewXzc.Common.DEncrypt.DESEncrypt.Encrypt(pwd);//给密码加密

                    if (user_model.PWD != pwd)
                    {
                        result = "no";
                    }
                }
            }
            else
            {
                result = "nologin";
            }

            context.Response.Write(result);
        }
コード例 #2
0
        private void SendPhoneVerifyCode(HttpContext context)
        {
            int uid = CheckIsLogin_HongRenHui.GetUserID("FINDRED_HREN_USERID");

            string phone = "";

            user_model = user_bll.GetModel(uid);

            if (user_model != null)
            {
                phone = user_model.TEL;
            }

            if (phone != "")
            {
                Random rd   = new Random();
                string code = rd.Next(100000, 999999).ToString();



                //前台生成的验证码,用于点击发送验证码前验证用
                string send_code_yzm = String_Manage.Return_Request_Str("send_code_yzm");

                if (send_code_yzm != "")
                {
                    try
                    {
                        if (HttpContext.Current.Session["code"] != null)
                        {
                            if (!string.IsNullOrEmpty(HttpContext.Current.Session["code"].ToString()))
                            {
                                string str_yzm = HttpContext.Current.Session["code"].ToString();
                                if (send_code_yzm != str_yzm)
                                {
                                    context.Response.Write("error_yzm");
                                }
                                else
                                {
                                    try
                                    {
                                        if (HttpContext.Current.Session["PhoneVerifyCode"] == null)
                                        {
                                            HttpContext.Current.Session["PhoneVerifyCode"] = code + "-" + phone;
                                        }
                                        else
                                        {
                                            if (string.IsNullOrEmpty(HttpContext.Current.Session["PhoneVerifyCode"].ToString()))
                                            {
                                                HttpContext.Current.Session["PhoneVerifyCode"] = code + "-" + phone;
                                            }
                                            else
                                            {
                                                string strSess = HttpContext.Current.Session["PhoneVerifyCode"].ToString();
                                                HttpContext.Current.Session["PhoneVerifyCode"] = strSess + "," + code + "-" + phone;
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        HttpContext.Current.Session["PhoneVerifyCode"] = code + "-" + phone;
                                    }
                                    finally
                                    {
                                        //判断当前用户是否已经绑定过手机
                                        #region  发送短信
                                        string shortMessageWord = "衣品搭配密码找回验证码:" + code + ",牢记密码,小主记得常来哦。";
                                        string result           = Send_Short_Message.Send_Message_Short(shortMessageWord, phone);
                                        //string result = "ok";
                                        //result = result + code;

                                        context.Response.Write(result);
                                        #endregion
                                    }
                                }
                            }
                            else
                            {
                                context.Response.Write("noyzm");
                            }
                        }
                        else
                        {
                            context.Response.Write("noyzm");
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else
                {
                    context.Response.Write("noyzm");
                }
            }
            else
            {
                context.Response.Write("nologin");
            }
        }