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

          '受屏蔽IP地址(段)集合,星號(hào)為通配符,通常保存于配置文件中。
          Const BadIPGroup = "123.123.*.*|118.73.47.*"
          If IsForbidIP(BadIPGroup) = True Then
          'Response.Write(GetIP &"IP地址禁止訪問(wèn)")
          Response.Write "<script>alert('["&GetIP&"]:這里不歡迎你,你去火星吧!');this.location.href='http://Response.End
          End If
          '****************************************************************
          '參數(shù)vBadIP:要屏蔽的IP段,IP地址集合,用|符號(hào)分隔多個(gè)IP地址(段)
          '返回Bool:True用戶(hù)IP在被屏蔽范圍,F(xiàn)alse 反之
          '****************************************************************
          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

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


          只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          常用鏈接

          留言簿(5)

          隨筆分類(lèi)

          隨筆檔案

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 常德市| 鄂州市| 宁晋县| 肇源县| 崇仁县| 鸡东县| 泰来县| 涪陵区| 宁河县| 双桥区| 阿合奇县| 赣州市| 顺平县| 和林格尔县| 咸阳市| 福泉市| 北碚区| 安岳县| 蓬莱市| 阿拉善右旗| 吉隆县| 叙永县| 如东县| 盐池县| 泰安市| 浑源县| 长宁县| 双辽市| 青海省| 通河县| 德保县| 伊宁县| 吉安县| 电白县| 永年县| 突泉县| 兰溪市| 明水县| 饶河县| 山东省| 诸城市|