예제 #1
0
 //TODO fix it
 public ActionResult Stat()
 {
     if (CheckCookie("stat"))
     {
         return(View(OperationStat.Show(_environment.WebRootPath)));
     }
     return(RedirectToAction("Index"));
 }
예제 #2
0
        public void Set(string key, string value)
        {
            CookieOptions option = new CookieOptions();

            option.Expires = DateTime.Now.AddHours(3);
            Response.Cookies.Append(key, value, option);

            OperationStat.set(
                value.Split(new char[] { ';' })[0],
                "login", Request.HttpContext.Connection.RemoteIpAddress.ToString(),
                _environment.WebRootPath);
        }
예제 #3
0
        private bool CheckCookie(string fr)
        {
            string cookie = _httpContextAccessor.HttpContext.Request.Cookies["manager"];

            if (cookie != null)
            {
                string s = Get("manager");
                string l = s.Split(new char[] { ';' })[0];
                string p = s.Split(new char[] { ';' })[1];
                if (Helpers.DbUser.Check(l, p))
                {
                    OperationStat.set(l, fr, Request.HttpContext.Connection.RemoteIpAddress.ToString(), _environment.WebRootPath);
                }
                return(true);
            }
            return(false);
        }