%
on error resume next
dim u,yy,pop,cap,vn,reg,tm,conid,conshort,conlong,cr,crc,ns,np,la,lo,mp
u=trim(Request.QueryString("ip"))
ipaddress =u'trim(Request.QueryString("ip"))
if trim(u)="" then
u=trim(Request.QueryString("ip"))
ipaddress =trim(Request.QueryString("ip"))
end if
ipno = Dot2LongIP(ipaddress)
yy=request.servervariables("PATH_INFO")
if trim(yy)="" then yy ="others"
Dim conn, rs, sql, accessdb, strconn,x,y,z,gtt
' select MS-Access database using DSNless connection
accessdb = server.mappath("ipcountry.mdb")
strconn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
strconn = strconn & accessDB & ";"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open strconn
strsql = "SELECT * FROM ipcountry WHERE " & ipno & " BETWEEN ipFROM AND ipTO"
Set rs = conn.execute(strsql)
x=rs("countrySHORT")
z="../flags/" & x & ".gif"
y=rs("countryLONG")
conshort=rs("countrySHORT")
conlong=rs("countryLONG")
If rs.EOF Then
z="../flags/a.gif"
end if
rs.close
set rs = nothing
conn.close
Set conn = nothing
'''''''''' get the country other information
accessdb = server.mappath("ipcountry.mdb")
strconn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
strconn = strconn & accessDB & ";"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open strconn
strsql = "Select * from con where iso2='" & x & "'"
Set rs = conn.execute(strsql)
reg=rs("mapreference")
cap=rs("capital")
cr=rs("currency")
crc=rs("curnencycode")
ns=rs("nationalitysingular")
np=rs("nationalityplural")
conid=rs("countryid")
pop=rs("population")
mp=rs("fips104")
If rs.EOF Then
pop="N/A"
reg="N/A"
cap="N/A"
cr="N/A"
crc="N/A"
ns="N/A"
np="N/A"
end if
rs.close
set rs = nothing
conn.close
Set conn = nothing
'''''''''' get the time zone other information
accessdb = server.mappath("ipcountry.mdb")
strconn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
strconn = strconn & accessDB & ";"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open strconn
strsql = "Select * from Cities where countryid=" & conid
Set rs = conn.execute(strsql)
tm=rs("timezone")
la=rs("latitude")
lo=rs("longitude")
If rs.EOF Then
tm="N/A"
end if
rs.close
set rs = nothing
conn.close
Set conn = nothing
' Convert dotted IP address into IP number in long
Function Dot2LongIP (ByVal DottedIP)
on error resume next
Dim i, pos
Dim PrevPos, num
If DottedIP = "" Then
Dot2LongIP = 0
Else
For i = 1 To 4
pos = InStr(PrevPos + 1, DottedIP, ".", 1)
If i = 4 Then
pos = Len(DottedIP) + 1
End If
num = Int(Mid(DottedIP, PrevPos + 1, pos - PrevPos - 1))
PrevPos = pos
Dot2LongIP = ((num Mod 256) * (256 ^ (4 - i))) + Dot2LongIP
Next
End If
End Function
conlong2=replace(conlong," ","_")
%>
IP Address Location
Free
IP2Stats Code
To add
this box in your website
Copy and paste this code between
<body>and </body> tags in your web page.
Or
to show visitors flag of there countries like this:
Copy and paste this code between
<body>and </body> tags in your web page.
Or
to show visitors flag and country name like this:
Copy and paste this code between
<body>and </body> tags in your web page.