Fonction de restriction IP
Si vous avez de bonnes suggestions et algorithmes, veuillez me contacter! ! :)
«*********************************************************
"FunctionCheckip (CINPUT_IP, CBOUND_IP)
«CreatedByqqdao, qqdao @ 263.net2001 / 11/28
"Remarque: d'abord, vous devez faire du vélo en fonction du nombre; alors déterminez s'il contient" - ", s'il y en a, effectuez un traitement divisé et déterminez enfin s'il se trouve dans la plage
"Paramètres: CINPUT_IP, IP pour l'inspection par génération
"CBOUND_IP, le format de plage donné est, IP unique et IP de plage, la plage IP est utilisée pour la dernière fois" - "segment, s'il est" * ", il doit être placé dans le dernier chiffre
"Ajouter": Autoriser "Une fois que chaque plage signifie que la connexion est autorisée, et l'ajout": refuser "signifie que la connexion est refusée. Plusieurs gammes sont utilisées pour"; "Isoler-les
"Par exemple, 192.168.1 *. *: Autoriser; 192.168.1.1: ALLOW; 192.168.1.1-10: Refuse"
"Valeur de retour: vrai / false
"MISE À JOUR: 2001/12/05 Les supports Autoriser, les supports de refus" * ', ne veulent pas être corrects? Support, car il est similaire à *
«*********************************************************
FonctionCheckip (Cinput_ip, cbound_ip)
dimcsingle_ip, ctemp_ip, cstart_ip, Cend_ip
Checkip = false
csingle_ip = split (cbound_ip, ";")
fori = 0Toubound (csingle_ip)
iFinstr (csingle_ip (i), "refuser") <> 0Then "Il suffit de refuser
ctemp_ip = Left (csingle_ip (i), instr (csingle_ip (i), ":") - 1)
iFinstr (ctemp_ip, "*") <> 0Then "est une large gamme
cStart_ip = Left (ctemp_ip, instr (ctemp_ip, "*") - 1)
ifleft (cinput_ip, Len (cStart_ip)) = cStart_ipthen
Checkip = false
sortie
endire
endire
iFinstr (ctemp_ip, "-") = 0THEN
cStart_ip = ctemp_ip
cend_ip = ctemp_ip
autre
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)
endire
ifip2str (cinput_ip)> = ip2str (cstart_ip) andip2str (cinput_ip) <= ip2str (cend_ip) puis
Checkip = false
sortie
endire
elseiFinstr (csingle_ip (i), "permettre") <> 0Then "Autoriser
ctemp_ip = Left (csingle_ip (i), instr (csingle_ip (i), ":") - 1)
iFinstr (ctemp_ip, "*") <> 0Then "est une large gamme
cStart_ip = Left (ctemp_ip, instr (ctemp_ip, "*") - 1)
ifleft (cinput_ip, Len (cStart_ip)) = cStart_ipthen
Checkip = true
endire
endire
iFinstr (ctemp_ip, "-") = 0THEN
cStart_ip = ctemp_ip
cend_ip = ctemp_ip
autre
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)
endire
ifip2str (cinput_ip)> = ip2str (cstart_ip) andip2str (cinput_ip) <= ip2str (cend_ip) puis
Checkip = true