dim ipfromto(45,45)
yourip=split(request.ServerVariables("remote_addr"),".")
realpath=server.MapPath("./iponly.txt")
set myobj = server.CreateObject("scripting.filesystemobject") set myfile = myobj.OpenTextFile(realpath)
i=1 while not myfile.atendofstream line=myfile.readline temp=split(line,"-")
ipfromto(i,1)=temp(0) ipfromto(i,2)=temp(1)
i=i+1 wend myfile.close
flag=false j=1 While j< 46
'split the from-ip and to-ip based on "." 'fromip has the from ip address in four parts 'toip has the to ip address in four parts
fromip=split(ipfromto(j,1),".") toip=split(ipfromto(j,2),".") if yourip(0) > = fromip(0) and yourip(0) < = toip(0) then
if yourip(1) > = fromip(1) and yourip(1) < = toip(1) then
if yourip(2) > = fromip(2) and yourip(2) < = toip(2) then
if yourip(3) > = fromip(3) and yourip(3) < = toip(3) then
flag=true
end if
end if end if
end if
if flag=true then 'Put your response.redirect() here flag=false else 'Put your response.redirect() here end if
j=j+1 wend |