<%
dim ipStr,userip
ipStr="10.119.0.*|10.119.1.*|10.119.*.1|10.*.99.1|10.119.*.*"
userip="1.11.99.15"
if(IPFilter(ipStr,userip)) then
response.Write("锁定的IP")
else
response.Write("欢迎访问")
end if
'-----------------------------------
'函数:IPFilter
'参数:iplist IP列表 uip判断是否在列表内
'----------------------------------
Function IPFilter(iplist, uip)
Dim regEx, retVal,patrn,ipArr
ipArr=split(iplist,"|")
for i=0 to ubound(ipArr)
patrn=replace(ipArr(i),"*","\d{1,3}")
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = False
retVal = regEx.Test(uip)
If retVal Then 'retVal位True代表锁定
exit for
End If
Set regEx=nothing
next
response.Write retVal
IPFilter=retVal
End Function
%>