function to look at some of the IP restrictions of the function, feel too complex. So, try to write a, relatively simple. Please refer to the user advice. Thank you! ~
Code Copy Box
<% ' Get visitor's address ip=request.servervariables (' remote_addr ') ' Allowed IP address segment is 10.0.0.0~10.68.63.255allowip1= ' 10.0.0.0 ' Allowip2= "10.68.10.71" Response.Write Checkip (IP,ALLOWIP1,ALLOWIP2) function Checkip (ip,allowip1,allowip2) Dim check (4) Checkip=falseipstr=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 FunctionEnd iffor i=0 to UBound (IPSTR) if CInt (Allow1 (i)) <cint (Allow2 (i)) thenif CInt (Allow1 (i)) =cint (Ipstr (i)) ) Thencheck (i) =truecheckip=trueexit Forelseif CInt (Ipstr (i)) <cint (Allow2 (i)) Thencheck (i) =truecheckip=trueexit Forelseif CInt (Ipstr (i)) >cint (Allow2 (i)) Thencheck (i) =falsecheckip=falseexit forelsecheck (i) =truecheckip= TrueEnd IfEnd IfEnd Ifelseif CInt (Allow1 (i)) >cint (Ipstr (i)) or CInt (Allow1 (i)) <cint (Ipstr (i)) thencheck (i) = Falsecheckip=falseif I<>ubound (ipstr) thenexit forend ifelsecheck (i) =trueend IfEnd-ifnextif (check (0) =true and Check (1) =true and check (2) =true and check (3) =False) and (CInt (Allow2 (2)) >cint (IPSTR (2)) Thencheckip=trueend IfEnd