如何验证IP地址?

所属分类: 网络编程 / 编程10000问 阅读数: 1000
收藏 0 赞 0 分享

 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

更多精彩内容其他人还在看

如何获知页面上的图象的实际尺寸?

如何获知页面上的图象的实际尺寸?
收藏 0 赞 0 分享

如何使图象随机显示?

如何使图象随机显示?
收藏 0 赞 0 分享

如何制作K线图?

如何制作K线图?
收藏 0 赞 0 分享

为什么有的留言簿不需要数据库?

为什么有的留言簿不需要数据库?
收藏 0 赞 0 分享

如何编写一个最简单的聊天程序?

如何编写一个最简单的聊天程序?
收藏 0 赞 0 分享

如何判断发言是否为空?

如何判断发言是否为空?
收藏 0 赞 0 分享

如何判断用户是否非正常离开聊天室?

如何判断用户是否非正常离开聊天室?
收藏 0 赞 0 分享

如何用变量实现群聊和悄悄话?

如何用变量实现群聊和悄悄话?
收藏 0 赞 0 分享

如何判断电子邮件的地址格式是否正确?

如何判断电子邮件的地址格式是否正确?
收藏 0 赞 0 分享

如何实现电子邮件的自动发送?

如何实现电子邮件的自动发送?
收藏 0 赞 0 分享
查看更多