当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 如何验证IP地址?

如何验证IP地址?

2017年12月01日  | 移动技术网IT编程  | 我要评论
 sub chkip(boardid)    dim rsip    dim iparr    dim

 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

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网