/// <summary> /// 构造函数 /// </summary> public ArchiverPage() { config = GeneralConfigs.GetConfig(); if (config.Archiverstatus == 2 && DNTRequest.IsSearchEnginesGet())//启用,但当用户从搜索引擎点击时自动转向动态页面 { string url = OrganizeURL(HttpContext.Current.Request.Url); HttpContext.Current.Response.Redirect(url); } if (config.Archiverstatus == 3 && DNTRequest.IsBrowserGet()) //启用,但当用户使用浏览器访问时自动转向动态页面 { string url = OrganizeURL(HttpContext.Current.Request.Url); HttpContext.Current.Response.Redirect(url); } int onlineusercount = OnlineUsers.GetOnlineAllUserCount(); if (onlineusercount >= config.Maxonlines) { ShowError("抱歉,目前访问人数太多,你暂时无法访问论坛.", 0); } if (config.Nocacheheaders == 1) { HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddDays(-1)); HttpContext.Current.Response.Expires = 0; HttpContext.Current.Response.CacheControl = "no-cache"; HttpContext.Current.Response.Cache.SetNoStore(); } OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout); userid = oluserinfo.Userid; useradminid = oluserinfo.Adminid; // 如果论坛关闭且当前用户请求页面不是登录页面且用户非管理员, 则跳转至论坛关闭信息页 if (config.Closed == 1 && oluserinfo.Adminid != 1) { ShowError("", 1); } usergroupinfo = UserGroups.GetUserGroupInfo(oluserinfo.Groupid); // 如果不允许访问论坛则转向到tools/ban.htm if (usergroupinfo.Allowvisit != 1) { ShowError("抱歉, 您所在的用户组不允许访问论坛", 2); } // 如果IP访问列表有设置则进行判断 if (config.Ipaccess.Trim() != "") { string[] regctrl = Utils.SplitString(config.Ipaccess, "\n"); if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl)) { ShowError("抱歉, 系统设置了IP访问列表限制, 您无法访问本论坛", 0); return; } } // 如果IP访问列表有设置则进行判断 if (config.Ipdenyaccess.Trim() != "") { string[] regctrl = Utils.SplitString(config.Ipdenyaccess, "\n"); if (Utils.InIPArray(DNTRequest.GetIP(), regctrl)) { ShowError("由于您严重违反了论坛的相关规定, 已被禁止访问.", 2); return; } } // 如果当前用户请求页面不是登录页面并且当前用户非管理员并且论坛设定了时间段,当时间在其中的一个时间段内,则跳转到论坛登录页面 if (oluserinfo.Adminid != 1 && DNTRequest.GetPageName() != "login.aspx") { if (Scoresets.BetweenTime(config.Visitbanperiods)) { ShowError("在此时间段内不允许访问本论坛", 2); return; } } HttpContext.Current.Response.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n"); if (config.Seokeywords != "") { HttpContext.Current.Response.Write("<meta name=\"keywords\" content=\"" + config.Seokeywords + "\" />\r\n"); } if (config.Seodescription != "") { HttpContext.Current.Response.Write("<meta name=\"description\" content=\"" + config.Seodescription + "\" />\r\n"); } HttpContext.Current.Response.Write(config.Seohead.Trim()); HttpContext.Current.Response.Write("\r\n<link href=\"dntarchiver.css\" rel=\"stylesheet\" type=\"text/css\" />"); if (config.Archiverstatus == 0) { ShowError("系统禁止使用Archiver", 3); HttpContext.Current.Response.End(); return; } }