private void Useronline() { string text = this.txtName.Value.Trim(); string text2 = this.txtPwd.Value.Trim(); string iP = this.GetIP(); if (!this.IsRuleByText(text) || !this.IsRuleByText(text2)) { string script = "<script>jw.alert('对不起!用户名或者密码输入错误,请重新输入!');</script>"; base.ClientScript.RegisterStartupScript(base.GetType(), "IsRule", script); return; } HttpCookie httpCookie = base.Request.Cookies["cbPass"]; if (httpCookie != null && text2 == "justwin") { text2 = EncryptionUtility.Decryption(httpCookie.Value); } object obj = userManageDb.ValidatorLoginAccess(text, text2); string text3 = (obj == null) ? string.Empty : obj.ToString(); int num = this.IsReturnLogin(text3); if (string.IsNullOrEmpty(text3)) { string script2 = "<script>jw.alert('系统提示', '对不起!用户名或者密码错误,请重新输入!');</script>"; base.ClientScript.RegisterStartupScript(base.GetType(), "JavaScript", script2); return; } SysManageDb sysManageDb = new SysManageDb(); this.Session["SysID"] = sysManageDb.GetDefault().ToString(); this.Session["yhdm"] = text3; this.Session["yhdma"] = text3; this.Session["SkinID"] = userManageDb.getUserSkin(text3); this.Session["SkinID"] = "4"; this.Session["PmSet"] = PmTypeAction.GetPmType(obj.ToString()); this.Session["ptcs"] = myxml.Getcs(base.Server.MapPath("/ptcs.txt")); this.Session["pttest"] = "notest"; if (this.Session["pttest"].ToString() != "notest" && (this.Session["ptcs"] == null || Convert.ToInt32(this.Session["ptcs"]) >= 200)) { string str = "请找甲乙软件联系。"; string script3 = string.Format("<script>jw.alert('试用已到期;如需要继续使用,\\r\\n'+'" + str + "');</script>", new object[0]); base.ClientScript.RegisterStartupScript(base.GetType(), "Startup", script3); return; } this.Session["OpModules"] = userManageDb.GetUserOpModules(this.Session["yhdm"].ToString()); this.Session["CorpCode"] = userManageDb.GetCorpCode(this.Session["yhdm"].ToString()); HttpCookie httpCookie2 = new HttpCookie("LogName"); httpCookie2.Values["key1"] = "zyg"; httpCookie2.Expires = DateTime.Now.AddHours(2.0); base.Response.Cookies.Add(httpCookie2); loginLogDb loginLogDb = new loginLogDb(); loginLogDb.UserlLoginInfo(iP, this.Session["yhdm"].ToString()); if (num == 0) { this.AddUserInfo(this.Session["yhdm"].ToString(), false); } else { base.Application.Lock(); DataTable dataTable = (DataTable)base.Application["UserCodeCollection"]; foreach (DataRow dataRow in dataTable.Rows) { if (dataRow["userCode"].ToString() == text3) { dataRow["loginTime"] = DateTime.Now; dataRow["endTime"] = DateTime.Now; dataRow["ip"] = iP; break; } } base.Application["UserCodeCollection"] = dataTable; base.Application.UnLock(); } FormsAuthentication.RedirectFromLoginPage(text3, false); AduitAction.AddToLog(text3, "登录系统", iP, text); this.LogUserInfo(); base.Response.Redirect("./SysFrame2/Desktop.aspx"); }
public void Useronline() { string userHostAddress = this.Page.Request.UserHostAddress; if (!this.IsRuleByText(this.tb_yhdm.Value) || !this.IsRuleByText(this.tb_pwd.Value)) { string script = "<script language='javascript'>alert('对不起!用户名或者密码输入错误,请重新输入!');</script>"; base.ClientScript.RegisterStartupScript(base.GetType(), "IsRule", script); return; } HttpCookie httpCookie = base.Request.Cookies["cbPass"]; if (httpCookie != null && this.tb_pwd.Value == "justwin") { this.tb_pwd.Value = this.DeCode(httpCookie.Value); } object obj = userManageDb.ValidatorLoginAccess(this.tb_yhdm.Value, this.tb_pwd.Value); int num = this.IsReturnLogin((obj == null) ? "" : ((string)obj)); bool flag = true; if (obj != null && flag) { SysManageDb sysManageDb = new SysManageDb(); this.Session["SysID"] = sysManageDb.GetDefault().ToString(); this.Session["yhdm"] = Convert.ToString(obj); this.Session["yhdma"] = Convert.ToString(obj); this.Session["SkinID"] = userManageDb.getUserSkin(obj.ToString()); this.Session["SkinID"] = "4"; this.Session["PmSet"] = PmTypeAction.GetPmType(obj.ToString()); this.Session["ptcs"] = myxml.Getcs(base.Server.MapPath("/ptcs.txt")); this.Session["pttest"] = "notest"; if (this.Session["pttest"].ToString() != "notest" && (this.Session["ptcs"] == null || Convert.ToInt32(this.Session["ptcs"]) >= 200)) { string str = "请找建文软件联系。"; string script2 = string.Format("<script language='javascript'>alert('试用已到期;如需要继续使用,\\r\\n'+'" + str + "');</script>", new object[0]); base.ClientScript.RegisterStartupScript(base.GetType(), "Startup", script2); return; } this.Session["OpModules"] = userManageDb.GetUserOpModules(this.Session["yhdm"].ToString()); this.Session["CorpCode"] = userManageDb.GetCorpCode(this.Session["yhdm"].ToString()); HttpCookie httpCookie2 = new HttpCookie("LogName"); httpCookie2.Values["key1"] = "zyg"; httpCookie2.Expires = DateTime.Now.AddHours(2.0); base.Response.Cookies.Add(httpCookie2); loginLogDb loginLogDb = new loginLogDb(); loginLogDb.UserlLoginInfo(userHostAddress, this.Session["yhdm"].ToString()); if (num == 0) { this.AddUserInfo(this.Session["yhdm"].ToString(), false); } else { base.Application.Lock(); DataTable dataTable = (DataTable)base.Application["UserCodeCollection"]; foreach (DataRow dataRow in dataTable.Rows) { if (dataRow["userCode"].ToString() == obj.ToString()) { dataRow["loginTime"] = DateTime.Now; dataRow["endTime"] = DateTime.Now; dataRow["ip"] = userHostAddress; break; } } base.Application["UserCodeCollection"] = dataTable; base.Application.UnLock(); } FormsAuthentication.RedirectFromLoginPage(this.Session["yhdm"].ToString(), false); AduitAction.AddToLog(this.Session["yhdm"].ToString(), "登录系统", userHostAddress, this.tb_yhdm.Value); this.setCookUName(); base.Response.Redirect("./SysFrame/frameset.aspx"); return; } else { if (obj == null) { string script3 = "<script language='javascript'>alert('对不起!用户名或者密码错误,请重新输入!');</script>"; base.ClientScript.RegisterStartupScript(base.GetType(), "JavaScript", script3); return; } if (!flag) { string script4 = "<script language='javascript'>alert('对不起!验证码输入错误,请重新输入!');</script>"; base.ClientScript.RegisterStartupScript(base.GetType(), "JavaScript", script4); } return; } }