如何验证IP地址?

所属分类: 网络编程 / 编程10000问 阅读数: 973
收藏 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 分享

如何把Recordset转换成彩色的XML文件

如何把Recordset转换成彩色的XML文件
收藏 0 赞 0 分享

如何把URL和邮件地址转换为超级链接?

如何把URL和邮件地址转换为超级链接?
收藏 0 赞 0 分享

如何把一个Excel文件放到ASP页面中去?

如何把一个Excel文件放到ASP页面中去?
收藏 0 赞 0 分享

如何把中文转换为UNICODE?

如何把中文转换为UNICODE?
收藏 0 赞 0 分享

如何编写TOP 10之类的排行榜?

如何编写TOP 10之类的排行榜?
收藏 0 赞 0 分享

如何动态添加Form项?

如何动态添加Form项?
收藏 0 赞 0 分享

如何读取一个.ini文件?

如何读取一个.ini文件?
收藏 0 赞 0 分享

如何计算ASP页面的载入时间?

如何计算ASP页面的载入时间?
收藏 0 赞 0 分享
查看更多