public void AdminLogin() { string userName = RequestTool.RequestString("userName"); string UserPWD = RequestTool.RequestString("UserPWD"); string code = RequestTool.RequestString("code"); int saveusername = RequestTool.RequestInt("saveusername", 0); int type = RequestTool.RequestInt("type", 0); string loginerror = "false"; if (SYS.Verifycode_AdminLogin == "1") { try { loginerror = (string)HttpContext.Current.Session["loginerror"]; } catch { loginerror = "false"; } if (loginerror == "true") { if (CurrentCheckCode != code) { Response.Write(Language.Tag("验证码错误", CurrentLanguage.Code)); return; } } } UserPWD = EX_Admin.MD5(UserPWD); if (EX_Admin.AdminLogin(userName, UserPWD)) { Lebi_Administrator admin = EX_Admin.CurrentAdmin(); admin.Time_Last = admin.Time_This; admin.IP_Last = admin.IP_This; admin.Time_This = DateTime.Now; admin.Count_Login++; admin.IP_This = RequestTool.GetClientIP(); B_Lebi_Administrator.Update(admin); Log.Add("登陆系统", "Login", admin.id.ToString(), EX_Admin.CurrentAdmin()); HttpContext.Current.Session["loginerror"] = "false"; Response.Cookies.Add(new HttpCookie("AdminLoginError", "")); if (saveusername == 1) { Response.Cookies.Add(new HttpCookie("saveusername", "1")); Response.Cookies.Add(new HttpCookie("AdminUserName", userName)); } else { Response.Cookies.Add(new HttpCookie("saveusername", "")); Response.Cookies.Add(new HttpCookie("AdminUserName", "")); } if (type == 1) { site = new Site(); string url = "<script type=\"text/javascript\">window.location='" + site.AdminPath + "/default.aspx';</script>"; Response.Write(url); Response.End(); } else { Response.Write("OK"); } return; } if (SYS.Verifycode_AdminLogin == "1") { HttpContext.Current.Session["loginerror"] = "true"; } Log.Add("登陆系统", "Login", "", EX_Admin.CurrentAdmin(), "[" + userName + "]用户名或密码错误"); Response.Write(Language.Tag("用户名或密码错误", CurrentLanguage.Code)); return; }