ShowIP.exe 匯出文字檔 IP.txt。StartIP (長整數/字串) - 起始 IP 數值EndIP - 結束 IP 數值Country - 城市名稱ReUrl - 導向網址 (如 https://bj.example.com)StartIP = 1*256^3 + 1*256^2 + 0*256 + 0 = 16842752
EndIP = 1*256^3 + 1*256^2 + 0*256 + 255 = 16843007
可用程式批次轉換,或直接下載動網已處理好的 IP 庫。user_ip = Request.ServerVariables("REMOTE_ADDR")
userip_ary = Split(user_ip, ".")
tmp_userip = userip_ary(0)*256^3 + userip_ary(1)*256^2 + userip_ary(2)*256 + userip_ary(3)
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM ip WHERE StartIP <= " & tmp_userip & " AND EndIP >= " & tmp_userip
rs.Open sql, conn, 1, 1
If rs.EOF Then Response.Redirect "index.asp" Else Response.Redirect rs("ReUrl")
rs.Close: Set rs = Nothing
StartIP, EndIP 建立索引。