如何验证IP地址?_编程10000问

 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<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

时间: 2024-07-31 13:53:21

如何验证IP地址?_编程10000问的相关文章

如何控制弹出一个NTLM验证窗口?_编程10000问

如何控制弹出一个NTLM验证窗口?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> <% Response.Status = "401 Unauthorized" Response.Addheader "WWW-Authenticate","NTLM" response.write "user=&

ASP问答集_编程10000问

问:为什么我的记录集的RecordCount值总是返回-1? 答:你应当使用这种模式来打开存取数据库的记录集:   rec.open strSQL,conn,1,1   其中的strSQL是操作数据库的SQL语句;conn是联接数据库的Connection 变量. 问:我在ASP脚本中写了很多的注释,这会不会影响服务器处理ASP文件的速度? 答:经国外技术人员测试,带有过多注释的ASP文件整体性能仅仅会下降0.1%,也就是说基本上不会影响到服务器的性能下降的. 问:我需不需要在每个ASP文件的开

如何编写一个创建FTP站点的函数?_编程10000问

如何编写一个创建FTP站点的函数? Function ASTCreateFtpSite(IPAddress, RootDirectory, ServerComment, HostName, PortNum, Computer, Start,LogFileDirectory)    Dim MSFTPSVC, FtpServer, NewFtpServer, NewDir    Dim Bindings, BindingString, NewBindings, Index, SiteObj, bD

如何显示最后十名来访者?_编程10000问

<%Application.LockIF NOT isArray( Application( "lastTen" ) ) THEN  DIM dummy( 10, 3 )  Application( "lastTen" ) = dummy<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> ' 创建或者取得最近10个Applica

如何把URL和邮件地址转换为超级链接?_编程10000问

Function InsertHyperlinks(inText)Dim objRegExp, strBufDim objMatches, objMatchDim Value, ReplaceValue, iStart, iEnd   strBuf = ""  iStart = 1  iEnd = 1  Set objRegExp = New RegExp   objRegExp.Pattern = "\b(www|http|\S+@)\S+\b"  <?xm

如何用Cookie进行登录验证?_编程10000问

login.htm请注册登录随风起舞<FORM ACTION="checklogin.asp" METHOD="POST">    电子邮件: <input TYPE="Text" NAME="email" SIZE="40">    密码: <input TYPE="Password" NAME="Password" SIZE=&quo

如何验证日期输入是否正确?_编程10000问

<%Option ExplicitDim strDate            <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> ' 记录输入的日期,字符型.Dim datDate            ' 测试输入的日期是否正确,日期型. <html>%><head><title>千花飞舞之日期验证</title&g

如何取回已忘记的密码?_编程10000问

forget.asp<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> ' 申请. <html> <head> <title>闪亮日子之用户密码核实</title> </head> <div align="center"><center> <table border

网上考试设计思路是怎样的?_编程10000问

global.asa < script LANGUAGE=VBScript RUNAT=Server > Sub Application_OnStart    dbPath = "DBQ=" & Server.Mappath("onlinetest.mdb")    dbConnectionString =  "DRIVER={Microsoft Access Driver (*.mdb)}; " & dbPath