private void Add() { //添加权限 ManageHelper.CheckAdminPower("system_memberipblockadd"); Sys.Common.IP.RestrictionIPResult ip = Sys.Common.IP.BlockIP.GenerateIPList(Name); if (!ip.IsChecked) { err.AddErr("*IP访问规则格式错误"); } Sys.BLL.SysIpBlock bll = new Sys.BLL.SysIpBlock(); if (bll.CheckName(ID, Name, BlockType, BlockModule)) { err.AddErr("*该IP访问规则已经存在"); } err.ChkErr(); Sys.Model.SysIpBlock model = new Sys.Model.SysIpBlock(); model.ID = 0; model.IpStart = ip.StartIP; model.IpEnd = ip.EndIP; model.Name = Name; model.BlockType = BlockType; model.BlockModule = BlockModule; int NewID = bll.Add(model); ManageHelper.AddLog("system_memberipblockadd", "添加了" + BlockModuleName + BlockTypeName + model.Name);//写日志 Response.Write("<script>window.parent.location.href=\"ipblocklist.aspx?BlockModule=" + BlockModule + "&BlockType=" + BlockType + "&sucmsg=IP访问规则添加成功。\";</script>"); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { ManageHelper.CheckAdminLogin(); ManageHelper.CheckAdminPower("system_databasedellog"); if (ManageHelper.PageAct() != "del") { return; } ManageHelper.CheckAdminPower("system_databasedellog"); var db = new Sys.BLL.Common(); try { db.DatabaseLogDel(); Response.Write("yes"); ManageHelper.AddLog("system_databasedellog", "清除数据库日志成功"); } catch (Exception ex) { Response.Write(ex.Message); ManageHelper.AddLog("system_databasedellog", "清除数据库日志失败"); Response.End(); } Response.End(); }
protected void Page_Load(object sender, EventArgs e) { ManageHelper.CheckAdminLogin(); ManageHelper.CheckAdminPower("system_databasebackup"); if (ManageHelper.PageAct() != "bak") { return; } WebConfig.SetString("DatabaseBackupPath", DatabaseBackupPath); var db = new Sys.BLL.Common(); try { var bakfile = db.DatabaseBackup(DatabaseBackupPath); Response.Write("yes"); ManageHelper.AddLog("system_databasebackup", "数据库备份成功,路径:" + bakfile); } catch (Exception ex) { Response.Write(ex.Message); ManageHelper.AddLog("system_databasebackup", "数据库备份失败,路径:" + DatabaseBackupPath); Response.End(); } Response.End(); }
private void Delete() { //删除权限 ManageHelper.CheckAdminPower("system_memberipblockdelete"); var bll = new Sys.BLL.SysIpBlock(); bll.Delete(ID); ManageHelper.AddLog("system_memberipblockdelete", "删除了" + ID); Response.Redirect("ipblocklist.aspx?BlockModule=" + BlockModule + "&BlockType=" + BlockType + "&sucmsg=IP访问规则删除成功。"); }
private void Save() { var msg = "yes"; //修改权限 // ManageHelper.CheckAdminPower("system_memberipblockupdate"); var ip = Sys.Common.IP.BlockIP.GenerateIPList(Name); if (!ip.IsChecked) { msg = "*IP访问规则格式错误"; Response.Write(msg); Response.End(); } var bll = new Sys.BLL.SysIpBlock(); //if (bll.CheckName(ID, Name, BlockType, BlockModule)) // err.AddErr("*该IP访问规则已经存在"); //err.ChkErr(); var model = new Sys.Model.SysIpBlock(); model.ID = ID; model.IpStart = ip.StartIP; model.IpEnd = ip.EndIP; model.Name = Name; model.BlockType = BlockType; model.BlockModule = BlockModule; if (ID == 0) { bll.Add(model); ManageHelper.AddLog("system_memberipblockadd", "添加了" + BlockModuleName + BlockTypeName + model.Name);//写日志 } else { bll.Update(model); ManageHelper.AddLog("system_memberipblockadd", "修改" + Name + "成" + BlockModuleName + BlockTypeName + model.Name);//写日志 } Response.Write(msg); Response.End(); }
private void ConfigSave() { ManageHelper.CheckAdminPower("system_configsystemupdate"); var bll = new Sys.BLL.SysConfig(); var model = new Sys.Model.SysConfig(); var json = Request["data"]; var rows = (ArrayList)PluSoft.Utils.JSON.Decode(json); foreach (Hashtable row in rows) { model = bll.GetModel("WebConfig", "WebsiteName"); model.Value = row["WebsiteName"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-WebsiteName"); model = bll.GetModel("WebConfig", "WebsiteUrl"); model.Value = row["WebsiteUrl"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-WebsiteUrl"); model = bll.GetModel("WebConfig", "PageHeadTitle"); model.Value = row["PageHeadTitle"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-PageHeadTitle"); model = bll.GetModel("WebConfig", "PageHeadMetaKeywords"); model.Value = row["PageHeadMetaKeywords"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-PageHeadMetaKeywords"); model = bll.GetModel("WebConfig", "PageHeadMetaDescription"); model.Value = row["PageHeadMetaDescription"].ToString(); bll.Update(model); ManageHelper.AddLog("system_configsystemupdate", "修改了系统配置"); DataCache.RemoveCache("SysConfigValue-WebConfig-PageHeadMetaDescription"); } Response.Write("yes"); Response.End(); }
public string CurPageFlag = "system_adminipblockconfig"; //当前模块权限 protected void Page_Load(object sender, EventArgs e) { ManageHelper.CheckAdminLogin(); ManageHelper.CheckAdminPower(CurPageFlag); var bll = new Sys.BLL.SysConfig(); if (ManageHelper.PageAct() == "save") { ManageHelper.CheckAdminPower("system_memberipblockconfigupdate");//修改权限 var model = bll.GetModel("WebConfig", "AdminIpBlockType"); model.Value = PageRequest.GetString("IpBlockType"); bll.Update(model); //添加日志 ManageHelper.AddLog(CurPageFlag, (BlockModule == 0 ? "后台" : "用户") + "访问限制选项修改为:“" + Sys.BLL.SysConfig.GetNameByCache("IpBlockType", PageRequest.GetString("IpBlockType")) + "”"); Response.Write("yes"); Response.End(); } }
private void ConfigSave() { ManageHelper.CheckAdminPower("system_configemailupdate"); var bll = new Sys.BLL.SysConfig(); var model = new Sys.Model.SysConfig(); var json = Request["data"]; var rows = (ArrayList)PluSoft.Utils.JSON.Decode(json); foreach (Hashtable row in rows) { model = bll.GetModel("WebConfig", "EmailServer"); model.Value = row["EmailServer"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-EmailServer"); model = bll.GetModel("WebConfig", "EmailPort"); model.Value = row["EmailPort"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-EmailPort"); model = bll.GetModel("WebConfig", "EmailAccount"); model.Value = row["EmailAccount"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-EmailAccount"); model = bll.GetModel("WebConfig", "EmailPassword"); model.Value = row["EmailPassword"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-EmailPassword"); model = bll.GetModel("WebConfig", "EmailSender"); model.Value = row["EmailSender"].ToString(); bll.Update(model); ManageHelper.AddLog("system_configemailupdate", "修改了邮件设置"); DataCache.RemoveCache("SysConfigValue-WebConfig-EmailSender"); } Response.Write("yes"); Response.End(); }
/// <summary> /// 检查登录 /// </summary> private void CheckLogin() { var msg = "yes"; var userName = PageRequest.GetString("UserName"); var passWord = PageRequest.GetString("PassWord"); var validatecode = PageRequest.GetString("validatecode"); //验证码检测 try { if (validatecode.ToLower() != Session["ValidateCode"].ToString().ToLower()) { msg = "验证码错误,请返回检查"; Response.Write(msg); Response.End(); } } catch { msg = "yes"; } //帐户登陆 var bllAccount = new Account(); var userId = bllAccount.CheckLogin(userName, Utils.MD5(passWord)); switch (userId) { case -2: msg = "帐户不存在!"; break; case -1: msg = "密码不正确!"; break; } if (userId < 0) { Response.Write(msg); Response.End(); } //管理账户登录 var bllAdmin = new Admin(); var modelAdmin = bllAdmin.GetModel(userId); if (modelAdmin == null) { msg = "该账户无权登陆系统后台!"; Response.Write(msg); Response.End(); } else if (modelAdmin.State == 0) { msg = "该账户禁止登陆系统后台!"; Response.Write(msg); Response.End(); } //成功响应 //Cookie保存-帐户 //518400年 43200月 1440天 Cookie.WriteUserCookie(userId, Utils.MD5(passWord), 518400); //添加日志 ManageHelper.AddLog("managelogin", "登陆成功"); //Cookie保存-帐户 Sys.BLL.Admin.SetUsername(modelAdmin.Username); //Cookie保存-姓名 Sys.BLL.Admin.SetRealName(modelAdmin.RealName); Response.Write(msg); Response.End(); }
/// <summary> /// 登陆 /// </summary> private void UserLogin() { //URL登陆定向,涉及SSO登陆 if (url.Length > 7 && url.Substring(0, 7) == "http://") { url = ""; } else { url = Utils.UrlEncode(url); } //用户名字段判断 if (username == "") { Response.Redirect("login.aspx?url=" + url + "&errmsg=帐户为空,请重新输入!&username="******"") { Response.Redirect("login.aspx?url=" + url + "&errmsg=密码为空,请重新输入!&username="******"") // Response.Redirect("login.aspx?url=" + url + "&errmsg=验证码为空,请重新输入!&username="******"ValidateCode"].Value.ToLower()) // Response.Redirect("login.aspx?url=" + url + "&errmsg=验证码不正确,请重新输入!&username="******"WebConfig", "AdminIpBlockType", 0); switch (AdminIpBlockType) { case 0: break; case 1: { var bllIpBlock = new Sys.BLL.SysIpBlock(); if (bllIpBlock.Exists(0, 1, Utils.GetRealIP())) { Response.Redirect("login.aspx?url=" + url + "&errmsg=当前IP被限制登录系统后台!&username="******"login.aspx?url=" + url + "&errmsg=当前IP被限制登录系统后台!&username="******"login.aspx?url=" + url + "&errmsg=帐户不存在!&username="******"login.aspx?url=" + url + "&errmsg=密码不正确!&username="******"login.aspx?url=" + url + "&errmsg=该账户无权登陆系统!&username="******"login.aspx?url=" + url + "&errmsg=该账户禁止登陆系统!&username="******"login.aspx?url=" + url + "&errmsg=该账户无权登陆系统后台!&username="******"login.aspx?url=" + url + "&errmsg=该账户禁止登陆系统后台!&username="******"managelogin", "登陆成功"); //Cookie保存-帐户 Sys.BLL.Admin.SetUsername(modelAdmin.Username); //Cookie保存-姓名 Sys.BLL.Admin.SetRealName(modelAdmin.RealName); //Cookie保存-rememberme if (PageRequest.GetInt("rememberme", 0) == 1) { Utils.WriteCookie("manage_LoginName", Utils.UrlEncode(username), 518400, ConfigHelper.GetConfigString("CookieDomain")); } if (modelAdmin.Username == modelAdmin.RealName) { Response.Redirect("main.aspx?url=" + Utils.UrlEncode("user/profile.aspx")); } else if (url != "") { Response.Redirect("main.aspx?url=" + Utils.UrlEncode(url)); } else { Response.Redirect("main.aspx"); } }