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(); }
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 Check() { Sys.Common.IP.RestrictionIPResult ip = Sys.Common.IP.BlockIP.GenerateIPList(Name); if (!ip.IsChecked) { Response.Write("-1");//IP错误 Response.End(); } var bllIP = new Sys.BLL.SysIpBlock(); if (bllIP.CheckName(ID, Name, BlockType, BlockModule)) { Response.Write("-2");//重名 Response.End(); } Response.Write("1"); 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"); } }