protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Model.Angel_Admin admin_info = GetAdminInfo(); //管理员信息 //登录信息 if (admin_info != null) { Business.Angel_Admin_log bll = new Business.Angel_Admin_log(); //Model.Angel_Admin_log model1 = bll.GetModel(admin_info.UserName, 1, AngelActionName.ActionName.Login.ToString()); //if (model1 != null) //{ // //本次登录 // litIP.Text = model1.user_ip; //} //Age_manager_log model2 = bll.GetModel(admin_info.user_name, 2, AgeEnums.ActionEnum.Login.ToString()); //if (model2 != null) //{ // //上一次登录 // litBackIP.Text = model2.user_ip; // litBackTime.Text = model2.add_time.ToString(); //} } //LitUpgrade.Text = Utils.GetDomainStr(AgeKeys.CACHE_OFFICIAL_UPGRADE, DESEncrypt.Decrypt(AgeKeys.FILE_URL_UPGRADE_CODE, "Age")); //NewsNotice.Text = Utils.GetDomainStr(AgeKeys.CACHE_OFFICIAL_NOTICE, DESEncrypt.Decrypt(AgeKeys.FILE_URL_NOTICE_CODE, "Age")); //Utils.GetDomainStr("Age_cache_domain_info", "http://www.angelasp.com/upangelcms.asp?u=" + Request.Url.DnsSafeHost + "&i=" + Request.ServerVariables["LOCAL_ADDR"]); } }
/// <summary> /// 写入管理日志 /// </summary> /// <param name="action_type"></param> /// <param name="remark"></param> /// <returns></returns> public bool AddAdminLog(string action_type, string remark) { if (AngelSiteconfig.Islogstatus > 0) { Model.Angel_Admin model = GetAdminInfo(); Model.Angel_Admin_log adminlog = new Model.Angel_Admin_log(); adminlog.AdminId = model.ID; adminlog.AdminName = model.LoginName; adminlog.OperateIP = AngelRequest.GetIP(); adminlog.Operate_Value = action_type; adminlog.Explain = remark; bool issuccess = new Business.Angel_Admin_log().Add(adminlog); if (issuccess) { return(true); } } return(false); }
public void ProcessRequest(HttpContext context) { // string tableName = context.Request.Params["tableName"]; //表名 AngelRM.Business.Angel_Admin_log AdminNavBLL = new Business.Angel_Admin_log(); string ActionName = context.Request.Params["action"]; // string str_Corp_ID = Session["Corp_ID"] == null ? "" : Session["Corp_ID"].ToString(); //根据相应的表进行操作 switch (ActionName) { case "DelDB": string id = context.Request.Params["id"]; if (AdminNavBLL.Delete(id)) { context.Response.Write("{\"success\":true}"); } else { context.Response.Write("{\"success\":false}"); } break; case "List": ////查询节点分类列表 // C_xData tcu = new C_xData("t_nodetype", "NodeType"); // int pageNo = int.Parse(context.Request.Params["page"]); // int pageSize = int.Parse(context.Request.Params["rows"]); // string wheresql = string.Empty; // if (context.Request.Params["q"] != "" && context.Request.Params["q"] != null) // { // wheresql = string.Format(" nodeName like'{0}%' ", context.Request.Params["q"]); // } // else // { // wheresql = " 1=1 "; // } // tcu.SetConditionString(wheresql); // //获得分页数据 // int total = tcu.GetDataSetPage(pageNo, pageSize); // if (total > 0) // { // //数据集==>json串 // tcu.GetDsJson(total); // //写dataGrid数据 // context.Response.ContentType = "text/plain"; // context.Response.Clear(); // context.Response.Write(tcu.strDsJson); // } // else // { // context.Response.ContentType = "text/plain"; // context.Response.Clear(); // context.Response.Write("{total:0,rows:[]}"); //写空数据 // } ////========end 查询节点分类列表 break; default: context.Response.Write("{\"success\":false}"); break; } }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { msgtip.InnerHtml = "请输入用户名或密码"; return; } if (Session["AdminLoginCount"] == null) { Session["AdminLoginCount"] = 1; } else { Session["AdminLoginCount"] = Convert.ToInt32(Session["AdminLoginCount"]) + 1; } //判断登录错误次数 if (Session["AdminLoginCount"] != null && Convert.ToInt32(Session["AdminLoginCount"]) > 5) { msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!"; return; } Business.Angel_Admin bll = new Business.Angel_Admin(); Model.Angel_Admin model = bll.GetModel(userName, userPwd); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[AngelConst.ANGEL_SESSION_ADMIN] = model; Session.Timeout = 45; //写入登录日志 Model.Angel_Siteconfig SiteconfigInfo = new Business.Angel_Siteconfig().loadConfig(); if (SiteconfigInfo.Islogstatus > 0) { Model.Angel_Admin_log adminlog = new Model.Angel_Admin_log(); adminlog.AdminId = model.ID; adminlog.AdminName = model.LoginName; adminlog.OperateIP = AngelRequest.GetIP(); adminlog.Operate_Value = AngelActionName.ActionName.Login.ToString(); adminlog.Explain = "用户登录"; adminlog.AddTime = DateTime.Now; Business.Angel_Admin_log blllog = new Business.Angel_Admin_log(); bool aaa = blllog.Add(adminlog); // new Business.Angel_Admin_log().Add(adminlog); } //写入Cookies记住用户名 if (this.Issavepwd.Checked == true) { AngelUtils.WriteCookie("AgeRememberName", model.UserName, 16000); } else { AngelUtils.WriteCookie("AgeRememberName", "", 16000); } AngelUtils.WriteCookie("AgeRememberName", model.UserName, 16000); AngelUtils.WriteCookie("AdminName", "AngelRM", model.UserName); Response.Redirect("MainFrame/Main.aspx"); return; }