Function Everyone if there are good suggestions algorithm, contact me!! :)
'******************************
' Function Checkip (CINPUT_IP,CBOUND_IP)
' Created by Qqdao, Qqdao@263.net 2001/11/28
' Description: First you need to be based on the number loop, and then determine if there is a "-", if there is a split processing, and finally determine whether in the scope
' Parameters: Cinput_ip, Ip on behalf of check
' Cbound_ip, given a range of formats, a single IP, and range IP, the range IP last used "-" split, if it is "*" must be put to the last
' After each range add ': ALLOW ' indicates permission to login, add ": Refuse" indicates refusal to log in. multiple ranges with ";" Separated
' such as 192.168.1*.*:allow;192.168.1.1:allow;192.168.1.1-10:refuse '
' Return value: True/false
' Update: 2001/12/05 support Allow,refuse Support ' * ', do not want to? Support, because and * almost
'******************************
function Checkip (CINPUT_IP,CBOUND_IP)
Dim csingle_ip,ctemp_ip,cstart_ip,cend_ip
Checkip = False
Csingle_ip=split (Cbound_ip, ";")
For i=0 to UBound (CSINGLE_IP)
If Instr (Csingle_ip (i), "refuse") <> 0 Then ' is rejected
Ctemp_ip = Left (Csingle_ip (i), InStr (Csingle_ip (i), ":")-1)
If Instr (ctemp_ip, "*") <> 0 Then ' is wide range
Cstart_ip = Left (Ctemp_ip,instr (CTEMP_IP, "*")-1)
If left (Cinput_ip,len (CSTART_IP)) =cstart_ip Then
Checkip = False
Exit function
End If
End If
If Instr (Ctemp_ip, "-") = 0 Then
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)
End If
If Ip2str (cinput_ip) >=ip2str (CSTART_IP) and Ip2str (CINPUT_IP) <=ip2str (CEND_IP) Then
Checkip = False
Exit function
End If
ElseIf Instr (Csingle_ip (i), "ALLOW") <> 0 Then ' Allow
Ctemp_ip = Left (Csingle_ip (i), InStr (Csingle_ip (i), ":")-1)
If Instr (ctemp_ip, "*") <> 0 Then ' is wide range
Cstart_ip = Left (Ctemp_ip,instr (CTEMP_IP, "*")-1)
&