I create a table in Db
ip2country
Name Null? Type
----------------------------------------- -------- ------------------------
----
SOURCE VARCHAR2(255)
CREATED DATE
COUNTRY VARCHAR2(255)
IP_FROM VARCHAR2(255)
IP_TO VARCHAR2(255)
IP_FROM_NUM NUMBER
IP_TO_NUM NUMBER
IP_RANGE NUMBER
and populate from
IP Registration:
1.
*************** *************** *************** *************** *************** *
*****
apnic - Asia Pacific Network Information Center
File - free
URI -
http://www.apnic.org/
Path -
ftp://ftp.apnic.net/pub/apnic/stats/apnic/
2.
*************** *************** *************** *************** *************** *
*****
lacnic - Latin American and Caribbean Internet
Addresses Registry
URI -
http://lacnic.net
File - free
Path -
ftp://ftp.lacnic.net/pub/stats/lacnic/
3.
*************** *************** *************** *************** *************** *
*****
arin - American Registry for Internet Numbers
File - free
URI -
http://www.arin.net
Path -
ftp://ftp.arin.net/pub/stats/arin/
4.
*************** *************** *************** *************** *************** *
*****
ripe - Regional Internet Registries (RIR) in
Europe
File - free
URI -
http://www.ripe.net
Path -
ftp://ftp.ripe.net/ripe/stats/
*************** *************** *************** *************** *************** *
*********
you need convert ip string to long
Public Function Convert_String_ Ip_To_Long(ByVa l In_Ip As String) As Long
Dim int_Index As Integer
Dim lngResults As Long
Dim IpArr As String()
IpArr = In_Ip.Split("." .ToCharArray)
For int_Index = 0 To 3
If Not int_Index = 3 Then
' Convert the number To a value range that can be parsed from the
others
IpArr(int_Index ) = (CLng(IpArr(int _Index)) * (256 ^ (3 -
int_Index))).To String
End If
' Add the number To the results
lngResults = lngResults + CLng(IpArr(int_ Index))
Next
Return lngResults
End Function
Public Function Convert_Long_Ip _To_String(ByVa l In_Ip As Long) As String
Dim _Ip As IPAddress = New IPAddress(In_Ip )
Dim Result As String = ""
Dim Arr As String()
Arr = (_Ip.ToString). Split(".".ToCha rArray)
For i As Integer = 3 To 0 Step -1
If i = 0 Then
Result = Result & Arr(i)
Else
Result = Result & Arr(i) & "."
End If
Next
Return Result
End Function
it will be easy to search in DB
example:
If s.StartsWith("r ipencc|") Then
line = s.Split("|".ToC harArray)
If line(2) = "ipv4" And line(1) <> "*" Then
If IsNumeric(line( 4)) Then
range = CLng(line(4))
ipFrom = Convert_String_ Ip_To_Long(line (3))
ipFromStr = line(3)
ipTo = ipFrom + range
ipToStr = Convert_Long_Ip _To_String(ipTo )
sql &= " Insert Into IP2COUNTRY (SOURCE,CREATED ,
COUNTRY,IP_FROM _NUM,IP_TO_NUM, IP_FROM,IP_TO,I P_RANGE )"
sql &= " VALUES ('RIPENCC',SYSD ATE"
sql &= "," & _quote(line(1))
sql &= "," & ipFrom
sql &= "," & ipTo
sql &= "," & _quote(ipFromSt r)
sql &= "," & _quote(ipToStr)
sql &= "," & range
sql &= " )"
Execute_DML(sql , Cnn)
End If
End If
"Lloyd Dupont" <ll***@RemoveIf NotSpamming.gal ador.net> wrote in message
news:#h******** ******@TK2MSFTN GP09.phx.gbl...
from the IP of the request ?