Function PubFgdy(Test,Tag,Bh)
PubFgdy=""
if Test<>"" and isnumeric(Bh)=true Then
Dim Tests
Tests=split(Test&Tag,Tag)
if Bh<Ubound(Tests) then
PubFgdy=Tests(Bh)
end if
else
PubFgdy=""
exit function
end if
end function
'//********************************************************************
' 判断 ip地址的范围, IpCheck=1时,ipThis在ipStart和ipEnd 之间,IpCheck=0时否
//********************************************************************
Function IpCheck(ipStart,ipEnd,ipThis)
IpCheck=0
dim diffSE, diffST
diffSE=IpDiffNum(ipStart, ipEnd)
diffST=IpDiffNum(ipStart,ipThis)
diffET=IpDiffNum(ipEnd,ipThis)
if diffSE=0 then
if diffST>0 then IpCheck=1
if diffSE>0 then IpCheck=1
if PubFgdy(ipStart,".",0)< PubFgdy(ipThis,".",0) and PubFgdy(ipEnd,".",0)>PubFgdy(ipStart,".",0) then IpCheck=1
exit function
end if
if diffSE=1 then
if diffST>1 then IpCheck=1
if diffSE>1 then IpCheck=1
if diffST=1 then
if PubFgdy(ipStart,".",1)<PubFgdy(ipThis,".",1) and PubFgdy(ipEnd,".",1)>PubFgdy(ipThis,".",1) then IpCheck=1
end if
exit function
end if
if diffSE=2 then
if diffST>2 then IpCheck=1
if diffSE>2 then IpCheck=1
if diffST=2 then
if PubFgdy(ipStart,".",2)<PubFgdy(ipThis,".",2) and PubFgdy(ipEnd,".",2)>PubFgdy(ipThis,".",2) then IpCheck=1
end if
exit function
end if
if diffSE=3 then
if diffST=4 then IpCheck=1
if diffET=4 then IpCheck=1
if diffST=3 then
if PubFgdy(ipStart,".",3)<PubFgdy(ipThis,".",3) and PubFgdy(ipEnd,".",3)>PubFgdy(ipThis,".",3) then IpCheck=1
end if
exit function
end if
if diffSE=4 then
if diffST=4 then IpCheck=1
end if
End Function
'//********************************************************************
判断两个 ip地址 第一个不相同的位置
'//********************************************************************
Function IpDiffNum(ipStart, ipEnd)
dim i
i=0
IpDiffNum=4 'IpDiffNum Ϊ4ʱ£¬Á½¸öµØÖ·Ïàͬ #####
For i=0 to 3
if PubFgdy(ipStart,".",i)<>PubFgdy(ipEnd,".",i) then
IpDiffNum=i
exit for
end if
Next