I recently wrote a small program to determine whether it is a domestic IP address. The Chinese version will automatically jump to the Chinese version, and the foreign version will automatically jump to the English version.
It is not ideal to search many materials. In addition, many IP address libraries can identify specific regions. And there is no domestic or foreign division.
It is hard to find IP segments in China, but there is no ready-made IP address library.
There is no way, so you have to export the txt text to the database.
Now I will share the simple judgment code and SQL Server Ip address library with you. I hope you will not have to worry about it in the future! <%
'Bijia Compilation
'Blog: http://bijia.anyflex.cn/
'Judge the domestic IP Address
Dim DBC, Conn
Set DBC = New DataBaseClass
Set Conn = DBC. OpenConnection ()
Set DBC = Nothing
Dim Rs, SQL
Dim Ip, ip1, ipitem1
Ip1 = Request. ServerVariables ("REMOTE_ADDR ")
Ipitem1 = split (ip1 ,".")
Ip = ipitem1 (0) * 256*256*256 + ipitem1 (1) * 256*256 + ipitem1 (2) * 256 + ipitem1 (3) 'convert the Ip address to 256 in hexadecimal format
Set Rs = Server. CreateObject (G_FS_RS)
SQL = "Select * from ChinaIP where IpMin <" & Ip & "and IpMax>" & Ip
Rs. open SQL, conn, 1, 3
If Rs. EOF then
Response. redirect ("index_en.html") 'foreign address
Else
Response. redirect ("index_cn.html") 'domestic address
End if
%>
Click here to download
The original IP library is incomplete. Please update it again now!
Click here to download
Author: Bijia, at 20:23:57