Function
<%
' Get the visitor's address
Ip=request.servervariables ("REMOTE_ADDR")
' The allowed IP address segment is 10.0.0.0~10.68.63.255
allowip1= "10.0.0.0"
Allowip2= "10.68.10.71"
Response.Write Checkip (IP,ALLOWIP1,ALLOWIP2)
Function Checkip (ip,allowip1,allowip2)
Dim Check (4)
Checkip=false
Ipstr=split (IP, ".")
Allow1=split (Allowip1, ".")
Allow2=split (ALLOWIP2, ".")
If CInt (Allow1 (0)) >cint (allow2 (0)) Then ' Determine if the IP address segment is legitimate
Response.Write ' IP address segment Error! "
Exit Function
End If
for I=0 to UBound (IPSTR)
If CInt (Allow1 (i)) <cint (Allow2 (i)) then
if CInt ( Allow1 (i)) =cint (Ipstr (i)) then
Check (i) =true
Checkip=true
Exit for
Else
if CInt (Ipstr (i)) <cint ( Allow2 (i)) then
Check (i) =true
Checkip=true
Exit for
Else
if CInt (Ipstr (i)) >cint (Allow2 (i)) then
Check (i) =false
Checkip=false
Exit for
Else
Check (i) =true
checkip=true
End If
End If
End If
Else
if CInt (Allow1 (i)) >cint (Ipstr (i)) or CInt (Allow1 (i)) <cint (Ipstr (i)) then
Check (i) =false
Checkip=false
If I<>ubound (ipstr) then
Exit for
End If
Else
Check (i) =true
End If
End If
Next
if (check (0) =true and check (1) =true and check (2) =true and check (3) =false) and (CInt (Allow2 (2)) >cint (IPSTR (2))) then
Checkip=true
End If
End Function
%>