<%
'=====================================================.
'Return IP Information Disp_ipaddressData (IP, 0)
'=====================================================.
Fonction look_ip (ip)
Faible ...
'Réglage de l'objet de classe
Set Station = Nouveau TQQWRY
'Commencez la recherche et renvoyez les résultats de la recherche
«Vous pouvez déterminer si l'adresse IP existe dans la base de données en fonction de la valeur de retour QQWRY (IP), et certaines autres opérations peuvent être effectuées s'il n'y a pas d'existence
«Par exemple, vous avez construit une base de données en tant que chasse, je n'expliquerai pas en détail ici
IpType = wry.qqwry (ip)
'Pays: champs nationaux et régionaux
'Localstr: champs d'information provinciaux et municipaux et autres
Look_ip = wry.country & & wry.localtr
'' 'Look_ip = wry.country &
Fonction finale
'=====================================================.
'Retour à IP Information JS Appel
'=====================================================.
Fonction disp_ipaddressdata (ip, style)
Dimover, iltype
Set Station = Nouveau TQQWRY
IpType = wry.qqwry (ip)
Sélectionner le style de cas
Cas 1 Disp_ipAddressData = IP
Cas 2 Disp_ipAddressData = Station.Country
Cas 3 Disp_ipaddressData = wry.localtr
'Cas else disp_ipaddressdata = wry.country & & wry.localtr
Cas else disp_ipaddressdata = wry.country
Fin de sélection
Fonction finale
'=====================================================.
'Retour aux informations QQwry
'=====================================================.
Fonction wryinfo ()
Dimover, ipType, qqwry_tem (0), qqwry_tem1 (1)
'Réglage de l'objet de classe
Set Station = Nouveau TQQWRY
IpType = wry.qqwry (255.255.255.254)
'Lisez les informations de la version de la base de données
Qqwry_tem (0) = wry.country & & wry.localtr
'Lisez le nombre d'adresses IP de base de données
Qqwry_tem1 (1) = wry.recordCount + 1
Wryinfo = qqwry_tem (0) & qqwry_tem1 (1)
Fonction finale
Classe tqqwry
'=====================================================.
'Réputation variable
'=====================================================.
Dim Country, Localstr, BUF, Offset
Startdip privé, endip, countryflag
Public qqwryfile
Public Firststartip, LastStartip, RecordCount
Stream privé, endion
'=====================================================.
'Initialisation du module de classe
'=====================================================.
Private Sub class_inialize
Pays =
Localstr =
Startip = 0
Endip = 0
Countryflag = 0
Firststartip = 0
LastStartip = 0
Endipoff = 0
Qqwryfile = server.mappath (/data/qqwry.dat) 'QQ inventaire IP innocent, pour passer à votre chemin
Sub-Sub
'=====================================================.
'Adresse IP Converti en entier
'=====================================================.
Fonction iptoint (ip)
Iparray dim, je
IpArray = Split (ip,., -1)
Pour i = 0 à 3
Sinon ISNUMERIC (ipArray (i)) alors ipArray (i) = 0
Si Cint (ipArray (i)) <0 Thatn ipArray (i) = ABS (Cint (ipArray (i)))
Si Cint (ipArray (i))> 255 That ipArray (i) = 255
Suivant
IPToint = (Cint (ipArray (0)) * 256 * 256 * 256) + (Cint (ipArray (1)) * 256 * 256) + (Cint (ipArray (2)) * 256) + Cint (ipArray (3) Guérir
Fonction finale
'=====================================================.
`` Notre adresse IP inversée entière
'=====================================================.
Fonction inttoip (intValue)
p4 = int Valent -Fix (intValue / 256) * 256
IntValue = (intValue-P4) / 256
p3 = int Valent -Fix (intValue / 256) * 256
IntValue = (intValue-P3) / 256
p2 = int Valent -Fix (intValue / 256) * 256
IntValue = (intValue -P2) / 256
P1 = valeur int
INNIP = CSTR (P1) &.
Fonction finale
'=====================================================.
'Obtenez l'emplacement IP de démarrage
'=====================================================.
Fonctions privées GetStartip (Recno)
Offset = firststartip + recno * 7
Stream.Position = Offset
Buf = stream.read (7)
Endipoff = ASCB (midb (buf, 5, 1)) + (ASCB (midb (buf, 6, 1)) * 256) + (ASCB (midb (buf, 7, 1)) * 256 * 256)
StartIP = ASCB (midb (buf, 1, 1)) + (ascb (midb (buf, 2, 1)) * 256) + (ascb (midb (buf, 3, 1)) * 256 * 256) + (ascb (Midb (buf, 4, 1)) * 256 * 256 * 256)
GetStartip = startip
Fonction finale
'=====================================================.
'Obtenez la position IP End
'=====================================================.
Fonction privée GeeTedip ()
Stream.Position = Endipoff
Buf = stream.read (5)
Endip = ASCB (midb (buf, 1, 1)) + (ASCB (midb (buf, 2, 1)) * 256) + (ASCB (midb (buf, 3, 1)) * 256 * 256) + (ASCB (Midb (buf, 4, 1)) * 256 * 256 * 256)
Countryflag = ASCB (midb (buf, 5, 1))
Getendip = endip
Fonction finale
'=====================================================.
`` Obtenez des informations régionales, y compris le pays et la province et les villes
'=====================================================.
Private Sub Getcountry (IP)
Si (countryflag = 1 ou countryflag = 2) alors
Pays = getflagstr (endipoff + 4)
Si countryflag = 1 alors
LocalStr = getFlagstr (stream.position)
'Ce qui suit est utilisé pour obtenir les informations de la version de la base de données
Si ip> = iptoint (255.255.255.0) et ip <= iptoint (255.255.255.255)
LocalStr = getflagstr (endipoff + 21)
Pays = getflagstr (endipoff + 12)
Terminer si
Autre
LocalStr = getFlagstr (endipoff + 8)
Terminer si
Autre
Pays = getflagstr (endipoff + 4)
LocalStr = getFlagstr (stream.position)
Terminer si
«Filtrez les informations inutiles dans la base de données
Pays = garniture (pays)
LocalStr = Trim (LocalStr)
Si instr (pays, cz88.net) alors pays =
Si instr (localstr, cz88.net) alors localstr =
Sub-Sub
'=====================================================.
'Obtenez l'identifiant d'adresse IP
'=====================================================.
Fonction privée getflagstr (offset)
Drapeau faible
Drapeau = 0
Faire entier (vrai)
Stream.Position = Offset
Flag = ASCB (Stream.Read (1))
Si (drapeau = 1 ou drapeau = 2) alors
Buf = stream.read (3)
Si (drapeau = 2) alors
Countryflag = 2
Endipoff = offset -4
Terminer si
Offset = ASCB (midb (buf, 1, 1)) + (ASCB (midb (buf, 2, 1)) * 256) + (ASCB (midb (buf, 3, 1)) * 256 * 256)
Autre
Sortir faire
Terminer si
Boucle
Si (décalage <12) alors
Getflagstr =
Autre
Stream.Position = Offset
Getflastr = gettr ()
Terminer si
Fonction finale
'=====================================================.
'Obtenez les informations de la chaîne
'=====================================================.
Fonction privée gettr ()
Cale c
Gettr =
Faire entier (vrai)
C = ASCB (Stream.Read (1))
Si (c = 0) puis sortez faire
'S'il s'agit d'un byte à deux octets, un octet élevé est combiné en combinaison avec une synthèse de l'octet faible d'un caractère
Si c> 127 alors
Si stream.eos la sortie
GetTr = gettr & chr (ASCW (chrb (ascb (stream.read (1))) & chrb (c)
Autre
Gettr = gettr & chr (c)
Terminer si
Boucle
Fonction finale
'=====================================================.
'Fonction de base, exécutez la recherche IP
'=====================================================.
Fonction publique QQwry (DOTIP)
DIM IP, NRET
Dim Rangb, plage, gamme, gamme
Ip = iptoint (ddetip)
Set stream = createObject (adodb.stream)
Stream.mode = 3
Stream.Type = 1
Stream.
Stream.LoadFromfile qqwryfile
Stream.Position = 0
Buf = stream.read (8)
FirstStartip = ASCB (midb (buf, 1, 1)) + (ASCB (midb (buf, 2, 1)) * 256) + (ASCB (midb (buf, 3, 1)) * 256 * 256) + (ASCB (Midb (buf, 4, 1)) * 256 * 256 * 256)
LastStartip = ASCB (midb (buf, 5, 1)) + (ASCB (midb (buf, 6, 1)) * 256) + (ASCB (midb (buf, 7, 1)) * 256 * 256) + (ASCB (Midb (buf, 8, 1)) * 256 * 256 * 256)
RecordCount = int
'Impossible de trouver une adresse IP dans la base de données
If (recordCount <= 1) alors
Pays = inconnu
Qqwry = 2
Fonction de sortie
Terminer si
Rangb = 0
Plage = recordCount
Faire pourquoi (rangb <(plage -1))
RANGB + Range / 2)
Appelez Getstartip (Recno)
Si (ip = startip) alors
Rangb = réino
Sortir faire
Terminer si
If (ip> startip) alors
Rangb = réino
Autre
Plage = recno
Terminer si
Boucle
Appelez Getstartip (Rangb)
Appelez Getendip ()
If (startip <= ip) et (endip> = ip) puis
'Pas trouvé
nret = 0
Autre
' normale
nret = 3
Terminer si
Appelez Getcountry (IP)
Qqwry = nret
Fonction finale
'=====================================================.
'Fin de la classe
'=====================================================.
Sous-classe privée_terminée
Sur l'erreur reprendre ensuite
Stream.close
Si err alors err.clear
Set stream = rien
Sub-Sub
Classe finale
%>