📄 ipisp.asp
字号:
<HTML>
<HEAD><TITLE>
IP - Country - ISP Database Demo in Active Server Pages (ASP)
</TITLE></HEAD>
<BODY bgcolor="#FFFFFF">
<h1><b><u>Lookup Country & ISP by IP Address</u></h1></b>
Enter a dotted IP address (xxx.xxx.xxx.xxx) between <b>202.181.128.0</b> and <b>203.99.71.255</b>.<br>
<%
'---------------------------------------------------------------------------
' Title : Lookup Country & ISP by IP Address
' Description : This script lookup the country and ISP by IP address.
' Things that we can do with this script.
' 1. Display native language and currency
' 2. Redirect based on country
' 3. Digital rights management
' 4. Prevent password sharing and abuse of service
' 5. Reduce credit card fraud
' 6. Web log stats and analysis
' 7. Auto-selection of country on forms
' 8. Filter access from countries you do not do business with
' 9. Geo-targeting for increased sales and click-thrus
' 10. And much, much more!
' Requirements : ASP 2.0+ and MS-ACCESS 2000
' Installation : Copy this asp file (ipisp.asp) and
' mdb file (ipisp.mdb) into a web directory.
' Access this webpage using http protocol.
'
' Author : Hexa Software Development Center
' URL : http://www.location.com.my
' Copyright (c) 2002 by Hexa Software Development Center
'---------------------------------------------------------------------------
Response.Write " <form action=""" & Request("SCRIPT_NAME") & """ method=""POST"">" & vbCrLf
Response.Write " <input type=""text"" name=""ipaddress"">" & vbCrLf
Response.Write " <input type=""submit"" name=""submit"" value=""submit"">" & vbCrLf
Response.Write " </form>" & vbCrLf
If Not Request.Form("ipaddress") = "" Then
' get the IP address from the form
ipaddress = Request.Form("ipaddress")
ipno = Dot2LongIP(ipaddress)
' check if the IP address is supported in demo version
If (ipno < 3400892416) or (ipno > 3412281343) Then
Response.Write "IP address " & ipaddress & " is not supported in demo version.<br>" & vbCrLf
Else
Dim conn, rs, sql, accessdb, strconn
' select MS-Access database using DSNless connection
accessdb = server.mappath("ipisp.mdb")
strconn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
strconn = strconn & accessDB & ";"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open strconn
' query string to lookup the country by matching the range of IP address number
strsql = "SELECT * FROM IPISP WHERE " & ipno & " BETWEEN ipFROM AND ipTO"
' execute the query
Set rs = conn.execute(strsql)
Response.Write "<p>"
Response.Write "<h1><u>Lookup Result</u></h1>"
Response.Write "<table>"
' display results
If Not rs.EOF Then
Response.Write "<tr><td>IP Address : </td><td><b>" & ipaddress & "</b></td></tr>" & vbCrLf
Response.Write "<tr><td>Country Name (Short) : </td><td><b>" & rs("countrySHORT") & "</b></td></tr>" & vbCrLf
Response.Write "<tr><td>Country Name (Long) : </td><td><b>" & rs("countryLONG") & "</b></td></tr>" & vbCrLf
Response.Write "<tr><td>ISP Handler : </td><td><b>" & rs("ispNAME") & "</b></td></tr>" & vbCrLf
Else
Response.Write "<tr><td>IP Address : </td><td><b>" & ipaddress & "</b></td></tr>" & vbCrLf
Response.Write "<tr><td>Country Name (Short) : </td><td>-</td></tr>" & vbCrLf
Response.Write "<tr><td>Country Name (Long) : </td><td>-</td></tr>" & vbCrLf
Response.Write "<tr><td>ISP Handler : </td><td>-</td></tr>" & vbCrLf
End If
Response.Write "</table>"
Response.Write "</p>"
rs.close
set rs = nothing
conn.close
Set conn = nothing
End if
End If
' Convert dotted IP address into IP number in long
Function Dot2LongIP (ByVal DottedIP)
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
%>
<BR>
[<A HREF="https://www.regsoft.net/purchase.php3?productid=51029">Click here to purchase full database</A>]
<BR>
<BR>
Copyright (c) 2002 by <a href="http://www.location.com.my">Hexa Software Development Center</a>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -