Exemplo n.º 1
0
        protected override void OnPreInit(EventArgs e)
        {
            //check something
            SingleLogin single = new SingleLogin();
            string      domain = Request.Url.Host.ToLower();

            //if (domain.IndexOf("localhost") == -1 && domain.IndexOf("cnvedu.com") == -1)
            //{
            //    single.RemoveKey();
            //    Jscript.AlertAndRefreshParent(domain + "对不起,本程序只能应用于cnvedu.com,如需购买请联系QQ:441031656!", "/");
            //}
            //int year = DateTime.Now.Year;
            //int month = DateTime.Now.Month;
            //int day = DateTime.Now.Day;
            //if (year != 2010 || month != 10)
            //{
            //    Response.Write("测试阶段,不能更改时间!请将时间更新到2010年10月份!");
            //    Response.End();
            //}
            //else
            //{
            //    if (day > 10)
            //    {
            //        Response.Write("测试时间到期,请付余款。如您已经付款,请联系更新网站安全插件!");
            //        Response.End();
            //    }
            //}
            if (HttpContext.Current.Session["Admin"] == null)
            {
                Context.Response.Redirect("Default.aspx");
            }
            base.OnPreInit(e);
        }
Exemplo n.º 2
0
        protected override void OnPreInit(EventArgs e)
        {
            SingleLogin single = new SingleLogin();
            string      domain = Request.Url.Host.ToLower();

            if (domain.IndexOf("localhost") == -1 && domain.IndexOf("cnvedu.com") == -1)
            {
                single.RemoveKey();
                Jscript.AlertAndRefreshParent(domain + "对不起,本程序只能应用于cnvedu.com,如需购买请联系QQ:441031656!", "/");
            }

            //check something
            //int year = DateTime.Now.Year;
            //int month = DateTime.Now.Month;
            //int day = DateTime.Now.Day;
            //if (year != 2010 || month != 10)
            //{
            //    Response.Write("测试阶段,不能更改时间!请将时间更新到2010年10月份!");
            //    Response.End();
            //}
            //else
            //{
            //    if (day > 10)
            //    {
            //        Response.Write("测试时间到期,请付余款。如您已经付款,请联系更新网站安全插件!");
            //        Response.End();
            //    }
            //}

            if (HttpContext.Current.Session["usercode"] == null)
            {
                //Context.Session["SystemError"] = "您还没有登陆或者登陆已经超时!";
                //Context.Response.Redirect("/Login_xk.aspx");
                Jscript.RefreshParent("/Login_xk.aspx");
            }

            if (!single.IsLogin(HttpContext.Current.Session["usercode"]))
            {
                Jscript.AlertAndRefreshParent("你的帐号已在别处登陆,你被强迫下线!", "/");
            }
            base.OnPreInit(e);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 验证是否登陆及是否有此页面访问权限
        /// </summary>
        public bool CheckAuthority(string chapterCode)
        {
            chapterCode = chapterCode.Replace(" ", "").Replace("'", "");

            //可以试听
            if (IsFree(chapterCode))
            {
                return(true);
            }

            //该章节不可以试听

            //检查用户是否登陆
            if (HttpContext.Current.Session["userid"] == null)
            {
                //Context.Session["SystemError"] = "您还没有登陆或者登陆已经超时!";
                Session.Clear();
                return(false);
            }

            SingleLogin single = new SingleLogin();

            if (!single.IsLogin(HttpContext.Current.Session["usercode"]))
            {
                Jscript.AlertAndRefreshParent("你的帐号已在别处登陆,你被强迫下线!", "/");
            }

            //用户已登陆
            string userID = HttpContext.Current.Session["userid"].ToString();

            if (!CheckPayAndTime(chapterCode, userID))
            {
                return(false);
            }
            return(true);
        }