<%
          'IP屏蔽代碼:www.goudiannao.com

          '受屏蔽IP地址(段)集合,星號為通配符,通常保存于配置文件中。
          Const BadIPGroup = "123.123.*.*|118.73.47.*"
          If IsForbidIP(BadIPGroup) = True Then
          'Response.Write(GetIP &"IP地址禁止訪問")
          Response.Write "<script>alert('["&GetIP&"]:這里不歡迎你,你去火星吧!');this.location.href='http://Response.End
          End If
          '****************************************************************
          '參數vBadIP:要屏蔽的IP段,IP地址集合,用|符號分隔多個IP地址(段)
          '返回Bool:True用戶IP在被屏蔽范圍,False 反之
          '****************************************************************
          Function IsForbidIP(vBadIP)
          Dim counter, arrIPPart, arrBadIP, arrBadIPPart, i,j
          arrBadIP=split(vBadIP,"|")
          arrIPPart = Split(GetIP(), ".")
          For i = 0 To UBound(arrBadIP)
          counter = 0
          arrBadIPPart = Split(arrBadIP(i), ".")
          For j = 0 To UBound(arrIPPart)
          If(arrBadIPPart(j)) = "*" or Cstr(arrIPPart(j))=Cstr(arrBadIPPart(j)) Then
          counter = counter + 1
          End If
          Next
          If counter=4 Then
          IsForbidIP=True
          Exit Function
          END IF
          Next
          IsForbidIP = False
          End Function

          '***************
          '返回客戶IP地址
          '***************
          Function GetIP()
          dim ip
          IP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
          If IP = "" Then IP = Request.ServerVariables("REMOTE_ADDR")
          GetIP = IP
          End Function
          %>


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 哈巴河县| 金昌市| 冷水江市| 台湾省| 兴隆县| 将乐县| 福海县| 龙井市| 卓尼县| 万荣县| 安福县| 长沙县| 丰顺县| 马龙县| 南漳县| 民权县| 珠海市| 巴东县| 九寨沟县| 铜山县| 高雄市| 云龙县| 金寨县| 西盟| 清徐县| 筠连县| 尚志市| 革吉县| 满洲里市| 白朗县| 太仆寺旗| 东方市| 石楼县| 嘉祥县| 越西县| 商南县| 车险| 永清县| 巴林右旗| 交城县| 鄂尔多斯市|