コード例 #1
0
ファイル: system.cs プロジェクト: tbs005/---
 public bool checkIP()
 {
     try
     {
         string   content  = new XmlControl(HttpContext.Current.Server.MapPath("~") + @"\config\config.config").GetContent("config/security/cpallowip");
         string   clientIP = this.GetClientIP();
         string[] strArray = content.Split(new char[] { '|' });
         for (int i = 0; i < strArray.Length; i++)
         {
             string[] strArray2 = strArray[i].Split(new char[] { '.' });
             string[] strArray3 = clientIP.Split(new char[] { '.' });
             int      num2      = 4 - this.strCount(strArray[i], "*");
             int      num3      = 0;
             for (int j = 0; j < strArray2.Length; j++)
             {
                 if ((strArray2[j] != "*") && (strArray2[j] == strArray3[j]))
                 {
                     num3++;
                 }
             }
             if (num3 == num2)
             {
                 return(true);
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return(false);
 }
コード例 #2
0
ファイル: system.cs プロジェクト: tbs005/---
 public void loadConfig(int read)
 {
     this.defCC();
     if ((HttpContext.Current.Application["loadconfig"] == null) || (read == 1))
     {
         XmlControl control = new XmlControl(HttpContext.Current.Server.MapPath("~") + @"\config\config.config");
         HttpContext.Current.Application.Clear();
         HttpContext.Current.Application.RemoveAll();
         HttpContext.Current.Application.Add("web.open", control.GetContent("config/web/open"));
         HttpContext.Current.Application.Add("web.url", control.GetContent("config/web/url"));
         HttpContext.Current.Application.Add("web.forum", control.GetContent("config/web/forum"));
         HttpContext.Current.Application.Add("web.servername", control.GetContent("config/web/servername"));
         HttpContext.Current.Application.Add("web.title", control.GetContent("config/web/title"));
         HttpContext.Current.Application.Add("web.keywords", control.GetContent("config/web/keywords"));
         HttpContext.Current.Application.Add("web.description", control.GetContent("config/web/description"));
         HttpContext.Current.Application.Add("web.count", control.GetContent("config/web/count"));
         HttpContext.Current.Application.Add("web.icpinfo", control.GetContent("config/web/icpinfo"));
         HttpContext.Current.Application.Add("web.closetext", control.GetContent("config/web/closetext"));
         HttpContext.Current.Application.Add("alipay.email", control.GetContent("config/alipay/email"));
         HttpContext.Current.Application.Add("alipay.partner", control.GetContent("config/alipay/partner"));
         HttpContext.Current.Application.Add("alipay.key", control.GetContent("config/alipay/key"));
         if (HttpContext.Current.Application["web.open"].ToString() == "false")
         {
             return;
         }
         HttpContext.Current.Application.Add("db.debug", control.GetContent("config/db/debug"));
         HttpContext.Current.Application.Add("db.connect", this.Decrypt(control.GetContent("config/db/connect"), "wfwfwfwf"));
         DataProviders providers = new DataProviders();
         HttpContext.Current.Application.Add("game.modifychanamecount", control.GetContent("config/game/modifychanamecount"));
         HttpContext.Current.Application.Add("game.modifychanamemoney", control.GetContent("config/game/modifychanamemoney"));
         HttpContext.Current.Application.Add("game.charesetcount", control.GetContent("config/game/charesetcount"));
         HttpContext.Current.Application.Add("game.charesetgivepoint", control.GetContent("config/game/charesetgivepoint"));
         HttpContext.Current.Application.Add("game.charesetflv", control.GetContent("config/game/charesetflv"));
         HttpContext.Current.Application.Add("game.charesetlvstep", control.GetContent("config/game/charesetlvstep"));
         HttpContext.Current.Application.Add("game.charesetfmoney", control.GetContent("config/game/charesetfmoney"));
         HttpContext.Current.Application.Add("game.charesetmoneystep", control.GetContent("config/game/charesetmoneystep"));
         HttpContext.Current.Application.Add("game.commendmoney", control.GetContent("config/game/commendmoney"));
         HttpContext.Current.Application.Add("game.commendgold", control.GetContent("config/game/commendgold"));
         HttpContext.Current.Application.Add("game.commendreborn", control.GetContent("config/game/commendreborn"));
         HttpContext.Current.Application.Add("game.clearpkgold", control.GetContent("config/game/clearpkgold"));
         HttpContext.Current.Application.Add("game.petlvupgold2", control.GetContent("config/game/petlvupgold2"));
         HttpContext.Current.Application.Add("game.petlvupgold3", control.GetContent("config/game/petlvupgold3"));
         HttpContext.Current.Application.Add("game.skilllvupmoney", control.GetContent("config/game/skilllvupmoney"));
         HttpContext.Current.Application.Add("game.goldtomoney", control.GetContent("config/game/goldtomoney"));
         HttpContext.Current.Application.Add("game.vipoffer", control.GetContent("config/game/vipoffer"));
         HttpContext.Current.Application.Add("game.resetpointmoney", control.GetContent("config/game/resetpointmoney"));
         HttpContext.Current.Application.Add("game.resetpointgold", control.GetContent("config/game/resetpointgold"));
         HttpContext.Current.Application.Add("game.pssigngold", control.GetContent("config/game/pssigngold"));
         HttpContext.Current.Application.Add("game.changeinfogold", control.GetContent("config/game/changeinfogold"));
         HttpContext.Current.Application.Add("security.cpallowip", control.GetContent("config/security/cpallowip"));
         HttpContext.Current.Application.Add("security.blockip", control.GetContent("config/security/blockip"));
         HttpContext.Current.Application.Add("security.verifycode", control.GetContent("config/security/verifycode"));
         HttpContext.Current.Application.Add("register.allow", control.GetContent("config/register/allow"));
         HttpContext.Current.Application.Add("register.givegold", control.GetContent("config/register/givegold"));
         HttpContext.Current.Application.Add("register.stopregtext", control.GetContent("config/register/stopregtext"));
         HttpContext.Current.Application.Add("notice", providers.ExecScalarOne("select notice from web_notice "));
         HttpContext.Current.Application.Add("sell", providers.ExecScalarOne("select sell from web_notice "));
         HttpContext.Current.Application.Add("commendtext", providers.ExecScalarOne("select commend from mhcmember..web_notice"));
         HttpContext.Current.Application.Add("loadconfig", true);
     }
     if (HttpContext.Current.Request.QueryString["sid"] != null)
     {
         HttpContext.Current.Session["sid"] = "allowArea";
     }
     if (new AllowIP().ScopeIncludingIpAddress(this.GetClientIP()) && (HttpContext.Current.Request.QueryString["sid"] == null))
     {
         if (HttpContext.Current.Application["web.servername"].ToString().Equals("[墨香世界]"))
         {
             HttpContext.Current.Response.Redirect("http://www.skymso.com/notice.aspx", true);
         }
         if (HttpContext.Current.Application["web.servername"].ToString().Equals("[寶寶墨香]"))
         {
             HttpContext.Current.Response.Redirect("http://www.50mso.com/notice.aspx", true);
         }
     }
     if ((HttpContext.Current.Application["web.servername"].ToString().Equals("[51墨香]") && !new AllowIP().ScopeIncludingIpAddressx(this.GetClientIP())) && (HttpContext.Current.Request.QueryString["sid"] == null))
     {
         HttpContext.Current.Response.Redirect("http://www.50mso.com/notice.aspx", true);
     }
 }