예제 #1
0
        public override void Page_Load(ref NVelocity.VelocityContext context)
        {
            base.Page_Load(ref context);

            #region  加载头部及Title
            NewXzc.Web.templatecs.Head head = new Head();
            head.Init_Head(context, 0);

            context.Put("title", "找回密码_女装搭配|衣品搭配");
            #endregion

            int uid = CheckIsLogin_HongRenHui.GetUserID("FINDRED_HREN_USERID");

            if (uid <= 0)
            {
                context.Put("redirecturl", "/findpwd");
            }
            else
            {
                context.Put("codes", String_Manage.Return_Request_Str("code"));

                string tel = new BLL.RED_USER().GetModel(uid).TEL;

                //tel = tel.Substring(0, 3) + "****" + tel.Substring(7, 4);

                context.Put("tel", tel);
            }
        }
예제 #2
0
        /// <summary>
        /// 验证是否登录成功
        /// </summary>
        /// <param name="context"></param>
        private void Login_States(NVelocity.VelocityContext context)
        {
            int    login_type = String_Manage.Return_Request_Int("logintype", 0);
            string urls       = String_Manage.Return_Request_Str("urls");

            CookieManage_HongRenHui.AddCookie("RED_HREN_Login_Type", login_type.ToString(), 7, false);

            if (urls != "" && urls != "0")
            {
                CookieManage_HongRenHui.AddCookie("RED_HREN_Login_Urls", urls, 7, false);
            }
            else
            {
                CookieManage_HongRenHui.AddCookie("RED_HREN_Login_Urls", CheckIsLogin_HongRenHui.Get_User_CenterUrl_HongRenHui(), 7, false);
            }

            if (CheckIsLogin_HongRenHui.IsLogin("RED_HREN_USERID"))
            {
                if (urls != "")
                {
                    context.Put("redirecturl", urls);
                }
                else
                {
                    context.Put("redirecturl", CheckIsLogin_HongRenHui.Get_User_CenterUrl_HongRenHui());
                }
            }
        }
예제 #3
0
        private void GetLoginState(HttpContext context)
        {
            string result = "ok";

            if (!CheckIsLogin_HongRenHui.IsLogin("RED_HREN_USERID"))
            {
                result = "/login";
            }

            context.Response.Write(result);
        }
예제 #4
0
        public override void Page_Load(ref NVelocity.VelocityContext context)
        {
            base.Page_Load(ref context);

            #region  加载头部及Title
            NewXzc.Web.templatecs.Head head = new Head();
            head.Init_Head(context, 0);

            context.Put("title", "找回密码_女装搭配|衣品搭配");
            #endregion

            if (CheckIsLogin_HongRenHui.GetUserID("FINDRED_HREN_USERID") <= 0 || CookieManage_HongRenHui.GetCookieValue("FINDTEL_HREN_STATE") != "1")
            {
                context.Put("redirecturl", "/findpwd");
            }
        }
예제 #5
0
        private void Update_User_Pwd(HttpContext context)
        {
            string result = "ok";

            int uid = CheckIsLogin_HongRenHui.GetUserID("FINDRED_HREN_USERID");

            string phone = "";

            user_model = user_bll.GetModel(uid);

            if (user_model != null)
            {
                if (CookieManage_HongRenHui.GetCookieValue("FINDTEL_HREN_STATE") != "1")
                {
                    result = "notel";
                }
                else
                {
                    string pwd = String_Manage.Return_Request_Str("pwd");
                    if (pwd == "")
                    {
                        result = "nopwd";
                    }
                    else
                    {
                        pwd            = NewXzc.Common.DEncrypt.DESEncrypt.Encrypt(pwd);//给密码加密
                        user_model.PWD = pwd;

                        if (!user_bll.Update(user_model, 2))
                        {
                            result = "no";
                        }
                    }
                }
            }
            else
            {
                result = "nologin";
            }

            context.Response.Write(result);
        }
예제 #6
0
        /// <summary>
        /// 执行微信登录,并注册信息操作
        /// </summary>
        /// <param name="uname">用户名称或昵称</param>
        /// <param name="sex_val">性别值</param>
        /// <param name="user_head">用户头像地址</param>
        /// <param name="third_logintype">第三方登录类型,0:默认,1:QQ,2:Sina,3:微信</param>
        /// <param name="third_uopenid">第三方登录账号的唯一标识ID</param>
        /// <returns></returns>
        private string Is_Register_Wchat(string uname, string sex_val, string user_head, int third_logintype, string third_uopenid)
        {
            string result = "ok";

            string tel = "123456";
            string pwd = "123456";
            int    sex = 1;

            //登录途径,0:红人汇PC端,1:红人汇wap端,2:微吧PC端,3:微吧wap端
            int login_type = Convert.ToInt32(CookieManage_HongRenHui.GetCookieValue("RED_HREN_Login_Type"));


            pwd = NewXzc.Common.DEncrypt.DESEncrypt.Encrypt(pwd);//给密码加密

            if (sex_val == "1" || sex_val == "man" || sex_val == "男")
            {
                sex = 1;
            }
            else
            {
                sex = 2;
            }

            //int third_old_logintype = Convert.ToInt32(CookieManage_HongRenHui.GetCookieValue("RED_HREN_Third_Login"));


            if (user_bll.GetRecordCount(" third_openid='" + third_uopenid + "' ") <= 0)
            {
                if (third_uopenid != "")// && uname != "qzuser"  未授权(uname == "qzuser")
                {
                    //string[] uhead = user_head.Split(';');

                    //if (third_logintype == 1)
                    //{
                    //    //大头像
                    //    user_head = Save_Img_Http.Save_Img_WebRequest(uhead[0].ToString(), "jpg", 1);
                    //    ////小头像
                    //    //Save_Img_Http.Save_Img_WebRequest(uhead[1].ToString(), "jpg", 3);
                    //}
                    //else
                    //{
                    //    //大头像
                    //    user_head = Save_Img_Http.Save_Img_WebRequest(user_head, "jpg", 1);
                    //}

                    //大头像
                    int imgpre = 0;
                    if (third_logintype < 3)
                    {
                        imgpre = 1;
                    }
                    user_head = Save_Img_Http.Save_Img_WebRequest(user_head, "jpg", imgpre);

                    user_head = user_head.Replace("large_", "").Replace(ImgHelper.GetCofigShowUrl(), "");

                    int userguid = user_bll.GetMaxId();

                    string empty = "";
                    int    cnt_0 = 0;
                    int    utype = login_type + 1;//用户注册途径,0:红人议会,1:红人汇,2:红人汇手机端,3:微吧,4:微吧手机端,5:红人爱品

                    user_model.USERID               = userguid;
                    user_model.USERNAME             = uname;
                    user_model.PWD                  = pwd;
                    user_model.TEL                  = tel;
                    user_model.TEL_STATE            = cnt_0;
                    user_model.USER_HEAD            = user_head;
                    user_model.SEX                  = sex;
                    user_model.EMAIL                = empty;
                    user_model.USER_TYPE            = utype;
                    user_model.ISCOMPLETE           = cnt_0;
                    user_model.PROVINCE             = empty;
                    user_model.CITY                 = empty;
                    user_model.AREA                 = empty;
                    user_model.PEOPLE_IDENTITY      = empty;
                    user_model.OCCUPATION           = empty;
                    user_model.PERSONALITY          = empty;
                    user_model.INTRODUCE            = empty;
                    user_model.IDENTIFICATION_STATE = cnt_0;
                    user_model.SAME_HOBBY_PEOPLE    = empty;
                    user_model.EXP                  = cnt_0;
                    user_model.SCORE                = cnt_0;
                    user_model.REALM_NAME           = empty;
                    user_model.ADDTIME              = DateTime.Now;
                    user_model.IS_RED               = cnt_0;
                    user_model.STATE                = cnt_0;
                    user_model.REMARK               = empty;
                    user_model.Person_Desc          = empty;
                    user_model.Person_NickName      = empty;
                    user_model.Porder               = cnt_0;
                    user_model.UpdateTime           = DateTime.Now;
                    user_model.PLAT_VAL             = empty;
                    user_model.SPECIALTY_VAL        = empty;
                    user_model.IPURL                = empty;



                    if (!user_bll.Add(user_model))
                    {
                        result = "no";
                    }
                    else
                    {
                        try
                        {
                            DbHelperSQL.ExecuteSql("update THINK_SNS_DB.dbo.hrenh_think_user set third_utype=" + third_logintype + ",third_openid='" + third_uopenid + "' where userid=" + userguid + " ");
                        }
                        catch (Exception ex)
                        {
                        }
                        CookieManage_HongRenHui.AddCookie("RED_HREN_USERID", userguid.ToString(), 7, false);
                        CookieManage_HongRenHui.AddCookie("RED_HREN_Third_Login", third_logintype.ToString(), 7, false);
                    }
                }
                else
                {
                    result = "noautho";
                }
            }
            else
            {
                #region  更新用户信息

                ////大头像
                //int imgpre = 0;
                //if (third_logintype < 3)
                //{
                //    imgpre = 1;
                //}
                //user_head = Save_Img_Http.Save_Img_WebRequest(user_head, "jpg", imgpre);

                //user_head = user_head.Replace("large_", "").Replace(ImgHelper.GetCofigShowUrl(), "");


                //try
                //{
                //    DbHelperSQL.ExecuteSql("update THINK_SNS_DB.dbo.hrenh_think_user set username='******',USER_HEAD='" + user_head + "' where third_openid='" + third_uopenid + "' ");
                //}
                //catch (Exception ex)
                //{

                //}

                #endregion

                CookieManage_HongRenHui.AddCookie("RED_HREN_USERID", DbHelperSQL.GetSingle("select top 1 userid from THINK_SNS_DB.dbo.hrenh_think_user where third_openid='" + third_uopenid + "' ").ToString(), 7, false);
                CookieManage_HongRenHui.AddCookie("RED_HREN_Third_Login", third_logintype.ToString(), 7, false);
            }

            if (result == "ok")
            {
                ////登录途径,0:红人汇PC端,1:红人汇wap端,2:微吧PC端,3:微吧wap端
                //switch (login_type)
                //{
                //    case 0:
                //        result = "http://www.ypindapei.com";
                //        break;
                //    case 1:
                //        result = "http://m.ypindapei.com";
                //        break;
                //    case 2:
                //        result = "http://weiba.ypindapei.com";
                //        break;
                //    case 3:
                //        result = "http://w.ypindapei.com";
                //        break;
                //    default:
                //        result = "http://www.ypindapei.com";
                //        break;
                //}
                //result = "/UserLogin/Login_Third.aspx";

                string urls = CookieManage_HongRenHui.GetCookieValue("RED_HREN_Login_Urls");

                if (urls != "" && urls != "0")
                {
                    result = urls;
                }
                else
                {
                    result = CheckIsLogin_HongRenHui.Get_User_CenterUrl_HongRenHui();
                }

                //登录微吧
                //Get_Http_Url_Content.GetPostContent("http://weiba.ypindapei.com/login?uid=" + NewXzc.Common.DEncrypt.DESEncrypt.Encrypt(CookieManage_HongRenHui.GetCookieValue("RED_HREN_USERID")));
            }

            return(result);
        }
예제 #7
0
        private void VerifyCodeIsExists(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 != "")
            {
                try
                {
                    string verifycode = context.Request["Vc"];

                    string phone2 = "", verifycode2 = "";

                    string[] items = null;

                    if (HttpContext.Current.Session["PhoneVerifyCode"] != null)
                    {
                        string PhoneVerifyCode = "";
                        PhoneVerifyCode = HttpContext.Current.Session["PhoneVerifyCode"].ToString();

                        if (PhoneVerifyCode.IndexOf(',') != -1)//有多个手机号和验证码,因为短信有可能延迟用户就会收到多个验证码,应该保证每个验证码是正确的。
                        {
                            items = PhoneVerifyCode.Split(',');
                        }
                        else
                        {
                            items    = new string[1];
                            items[0] = PhoneVerifyCode;
                        }
                    }

                    bool isOk = false;

                    for (int i = 0; i < items.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(items[i]))
                        {
                            phone2      = items[i].Split('-')[1];
                            verifycode2 = items[i].Split('-')[0];

                            if (phone == phone2 && verifycode == verifycode2)
                            {
                                isOk = true;
                                break;
                            }
                        }
                    }

                    if (isOk)
                    {
                        CookieManage_HongRenHui.AddCookie("FINDTEL_HREN_STATE", "1", 1, false);
                        context.Response.Write("1");
                    }
                    else
                    {
                        context.Response.Write("0");
                    }
                }
                catch (Exception ex)
                {
                    context.Response.Write("0");
                }
            }
            else
            {
                context.Response.Write("nologin");
            }
            context.Response.End();
        }
예제 #8
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");
            }
        }
예제 #9
0
        private void Is_Login(HttpContext context)
        {
            string result = "ok";

            string tel = String_Manage.Return_Request_Str("tel");
            string pwd = String_Manage.Return_Request_Str("upwd");

            pwd = NewXzc.Common.DEncrypt.DESEncrypt.Encrypt(pwd);//给密码加密

            int remmber = String_Manage.Return_Request_Int("remmber", 0);

            var istel = ValidatePhone_Function(context, tel);

            if (istel != "ok")
            {
                result = istel;
            }
            else
            {
                //前台生成的验证码,用于点击发送验证码前验证用
                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)
                                {
                                    result = "error_yzm";
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }

                if (result == "ok")
                {
                    string sql = "select top 1 userid from THINK_SNS_DB.dbo.HRENH_THINK_USER where tel=@tel and pwd=@pwd order by userid asc";

                    SqlParameter[] para =
                    {
                        new SqlParameter("@tel", SqlDbType.NVarChar, 50),
                        new SqlParameter("@pwd", SqlDbType.NVarChar, 50)
                    };
                    para[0].Value = tel;
                    para[1].Value = pwd;

                    int t = 0;
                    try
                    {
                        t = Convert.ToInt32(DbHelperSQL.GetSingle(sql, para).ToString());
                    }
                    catch (Exception ex)
                    {
                    }

                    if (t <= 0)
                    {
                        result = "no";
                    }
                    else
                    {
                        result = CheckIsLogin_HongRenHui.Get_User_CenterUrl_HongRenHui();

                        if (remmber == 0)
                        {
                            CookieManage_HongRenHui.AddCookie("RED_HREN_USERID", t.ToString(), 1, false);
                        }
                        else
                        {
                            CookieManage_HongRenHui.AddCookie("RED_HREN_USERID", t.ToString(), 7, false);
                        }
                    }
                }
            }


            context.Response.Write(result);
        }