如何验证IP地址?

栏目: 编程语言 · 发布时间: 8年前

内容简介:如何验证IP地址?

 sub chkIP(boardid)
   dim rsIP
   dim ipArr
   dim ignored
   dim i
   dim ip
   dim sql

   ip=Request.ServerVariables("REMOTE_ADDR")   
   ignored=false
   if not isempty(boardid) then   
     sql="select ignoreip from board where boardid="&cstr(boardid)
     set rsIP=conn.execute(sql)
     if not (rsIP.eof and rsIP.bof) then
      if instr(cstr(rsIP("ignoreip")&""),chr(13)&chr(10)) then
        iparr=split(rsIP("ignoreip"),chr(13)&chr(10))
        for i=0 to ubound(iparr)
          if trim(iparr(i))<>"" and left(ip,len(trim(iparr(i))))=trim(iparr(i)) then
           ignored=true
           exit for
          end if
        next
      else
        iparr=rsIP("ignoreip")
        if ip=trim(iparr) then
         ignored=true
        end if
      end if
     end if
     rsIP.close
   end if
   if ignored then
     response.write "<script language=javascript>window.location.href='ignoreip.htm'</script>"
   end if
 end sub


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

数据结构及应用算法教程

数据结构及应用算法教程

2011-5 / 45.00元

《数据结构及应用算法教程(修订版)》从数据类型的角度,分别讨论了四大类型的数据结构的逻辑特性、存储表示及其应用。此外,还专辟一章,以若干实例阐述以抽象数据类型为中心的程序设计方法。书中每一章后都配有适量的习题,以供读者复习提高之用。第1~9章还专门设有“解题指导与示例”一节内容,不仅给出答案,对大部分题目提供了详尽的解答注释;其中的一些算法题还给出了多种解法。书中主要算法和最后一章的实例中的全部程......一起来看看 《数据结构及应用算法教程》 这本书的介绍吧!

html转js在线工具
html转js在线工具

html转js在线工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具