'*********************************
'FunctionCheckIp(cInput_Ip,cBound_Ip)
'Createdbyqqdao,[email protected]/11/28
'Note: First, you need to loop based on the ; number, then determine whether it contains "-", if there is, perform split processing, and finally determine whether it is within the range
'Parameter: cInput_Ip, ip for the proxy check
'cBound_Ip, the given range format is, single ip, and range ip, the range ip is last used to split, if it is "*", it must be placed in the last digit
'Add ":ALLOW" after each range means that login is allowed, and adding ":REFUSE" means that login is refused. Use multiple ranges to separate
'For example 192.168.1*.*:ALLOW; 192.168.1.1:ALLOW; 192.168.1.1-10:REFUSE"
'Return value: true/false
'Update: 2001/12/05 supports ALLOW, REFUSE supports '*', don't want to be right? Supported, because it's almost the same as *
'*********************************
functionCheckIp(cInput_Ip,cBound_Ip)
dimcSingle_Ip,cTemp_IP,cStart_IP,cEnd_Ip
CheckIp=false
cSingle_Ip=split(cBound_Ip,";")
fori=0toubound(cSingle_Ip)
ifInstr(cSingle_Ip(i),"REFUSE")<>0then" just refuses
cTemp_IP=left(cSingle_Ip(i),instr(cSingle_Ip(i),":")-1)
ifInstr(cTemp_IP,"*")<>0then" is a wide range
cStart_IP=left(cTemp_IP,instr(cTemp_IP,"*")-1)
ifleft(cInput_Ip,len(cStart_IP))=cStart_IPthen
CheckIp=false
exitfunction
endif
endif
ifInstr(cTemp_IP,"-")=0then
cStart_IP=cTemp_IP
cEnd_Ip=cTemp_IP
else
cStart_IP=left(cTemp_IP,instr(cTemp_IP,"-")-1)
cEnd_Ip=left(cStart_IP,InStrRev(cStart_IP,".")-1)+"."+mid(cTemp_IP,instr(cTemp_IP,"-")+1)
endif
ifIp2Str(cInput_Ip)>=Ip2Str(cStart_IP)andIp2Str(cInput_Ip)<=Ip2Str(cEnd_Ip)then
CheckIp=false
exitfunction
endif
elseifInstr(cSingle_Ip(i),"ALLOW")<>0then" Allow
cTemp_IP=left(cSingle_Ip(i),instr(cSingle_Ip(i),":")-1)
ifInstr(cTemp_IP,"*")<>0then" is a wide range
cStart_IP=left(cTemp_IP,instr(cTemp_IP,"*")-1)
ifleft(cInput_Ip,len(cStart_IP))=cStart_IPthen
CheckIp=true
endif
endif
ifInstr(cTemp_IP,"-")=0then
cStart_IP=cTemp_IP
cEnd_Ip=cTemp_IP
else
cStart_IP=left(cTemp_IP,instr(cTemp_IP,"-")-1)
cEnd_Ip=left(cStart_IP,InStrRev(cStart_IP,".")-1)+"."+mid(cTemp_IP,instr(cTemp_IP,"-")+1)
endif
ifIp2Str(cInput_Ip)>=Ip2Str(cStart_IP)andIp2Str(cInput_Ip)<=Ip2Str(cEnd_Ip)then
CheckIp=true
else
CheckIp=false
endif
endif
next
endfunction
'*********************************