纯真ip数据库转换为(access)使用图文教程
发布时间:2010-04-20 09:42:25 作者:佚名
我要评论
有时候默认的纯真ip数据库因为程序问题,需要转换格式等,这里就简单的给大家演示一下,转换方法。
第一步:其实制作查询IP工具的时候,已经有PHP可以完美直接读取QQWry.Dat文件了,演示地址:http://tools.jb51.net/ip/index.php
源码下载地址 PHP IP查询系统(纯真IP数据库) v2.1
第二步:IPLook 1.5.exe就是可以将 QQWry.Dat 文件,转出txt文件的软件。(如果是看了脚本之家的文章来的朋友,下面的输出格式,需要选择IP以无符号整数表示)

第三步:将刚导出的txt文件转成数据库的工具

其它的就很方便修改了
下面是asp读取access的代码,注意字段的名称需要简单的修改下
<%'IP
Public Function address(sip)
Dim aConnStr,aConn,adb
Dim str1,str2,str3,str4
Dim num
Dim country,city
Dim irs,SQL
If IsNumeric(Left(sip,2)) Then
If sip="127.0.0.1" Then sip="192.168.0.1"
str1=Left(sip,InStr(sip,".")-1)
sip=mid(sip,instr(sip,".")+1)
str2=Left(sip,instr(sip,".")-1)
sip=Mid(sip,InStr(sip,".")+1)
str3=Left(sip,instr(sip,".")-1)
str4=Mid(sip,instr(sip,".")+1)
If isNumeric(str1)=0 or isNumeric(str2)=0 or isNumeric(str3)=0 or isNumeric(str4)=0 Then
Else
num=CLng(str1)*16777216+CLng(str2)*65536+CLng(str3)*256+CLng(str4)-1
adb = "ip.mdb"
aConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(adb)
Set AConn = Server.CreateObject("ADODB.Connection")
aConn.Open aConnStr
sql="select * from ip where startip <="&num&" and endip >="&num&""
Set irs=aConn.execute(sql)
If irs.EOF And irs.bof Then
local="尚未收录"
Else
local=irs("country")&irs("local")
End If
Set irs=Nothing
Set aConn = Nothing
SqlQueryNum = SqlQueryNum+1
End If
address=local
Else
address="未知"
End If
End Function
linkip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If linkip = "" Then linkip = Request.ServerVariables("REMOTE_ADDR")
ip=request.form("ip")
%>
<dd style="text-align:center"><span class="bot">+ + 您 的 IP : [ <%=linkip%> ] 来 自 : <%=address(linkip)%> + +
<%=Request.ServerVariables("HTTP_USER_AGENT")%></span>
<form method="post" target="_top" action="ip.asp" name="ipform" onsubmit="return checkIP();">
请输入要查询的IP:
<input type="text" name="ip" size="36" value="<%=ip%>" class=input> <input type="submit" value="点击查询" class=but></form>
<%
if request.ServerVariables("REQUEST_METHOD")="POST" then%>
<font color="#ff0000"><strong>查询结果 : <%=ip%> ==>> <%=ip%> ==>> <%=address(ip)%></strong></font>
上面四项依次显示的是 : 原始输入内容 <strong>==>></strong> 获取的IP地址 <strong>==>></strong> IP的物理位置
<%end if%>
文中所用工具打包下载 QQ IP数据库 纯真版 access(ip双精度)数据库制作工具
源码下载地址 PHP IP查询系统(纯真IP数据库) v2.1
第二步:IPLook 1.5.exe就是可以将 QQWry.Dat 文件,转出txt文件的软件。(如果是看了脚本之家的文章来的朋友,下面的输出格式,需要选择IP以无符号整数表示)

第三步:将刚导出的txt文件转成数据库的工具

其它的就很方便修改了
下面是asp读取access的代码,注意字段的名称需要简单的修改下
复制代码
代码如下:<%'IP
Public Function address(sip)
Dim aConnStr,aConn,adb
Dim str1,str2,str3,str4
Dim num
Dim country,city
Dim irs,SQL
If IsNumeric(Left(sip,2)) Then
If sip="127.0.0.1" Then sip="192.168.0.1"
str1=Left(sip,InStr(sip,".")-1)
sip=mid(sip,instr(sip,".")+1)
str2=Left(sip,instr(sip,".")-1)
sip=Mid(sip,InStr(sip,".")+1)
str3=Left(sip,instr(sip,".")-1)
str4=Mid(sip,instr(sip,".")+1)
If isNumeric(str1)=0 or isNumeric(str2)=0 or isNumeric(str3)=0 or isNumeric(str4)=0 Then
Else
num=CLng(str1)*16777216+CLng(str2)*65536+CLng(str3)*256+CLng(str4)-1
adb = "ip.mdb"
aConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(adb)
Set AConn = Server.CreateObject("ADODB.Connection")
aConn.Open aConnStr
sql="select * from ip where startip <="&num&" and endip >="&num&""
Set irs=aConn.execute(sql)
If irs.EOF And irs.bof Then
local="尚未收录"
Else
local=irs("country")&irs("local")
End If
Set irs=Nothing
Set aConn = Nothing
SqlQueryNum = SqlQueryNum+1
End If
address=local
Else
address="未知"
End If
End Function
linkip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If linkip = "" Then linkip = Request.ServerVariables("REMOTE_ADDR")
ip=request.form("ip")
%>
<dd style="text-align:center"><span class="bot">+ + 您 的 IP : [ <%=linkip%> ] 来 自 : <%=address(linkip)%> + +
<%=Request.ServerVariables("HTTP_USER_AGENT")%></span>
<form method="post" target="_top" action="ip.asp" name="ipform" onsubmit="return checkIP();">
请输入要查询的IP:
<input type="text" name="ip" size="36" value="<%=ip%>" class=input> <input type="submit" value="点击查询" class=but></form>
<%
if request.ServerVariables("REQUEST_METHOD")="POST" then%>
<font color="#ff0000"><strong>查询结果 : <%=ip%> ==>> <%=ip%> ==>> <%=address(ip)%></strong></font>
上面四项依次显示的是 : 原始输入内容 <strong>==>></strong> 获取的IP地址 <strong>==>></strong> IP的物理位置
<%end if%>
文中所用工具打包下载 QQ IP数据库 纯真版 access(ip双精度)数据库制作工具
相关文章

职场人慌了! DeepSeek配合Mermaid自动绘图的技巧
DeepSeek这玩意儿,配合Mermaid,自动生成甘特图,这速度,这效率,简直了神奇了,下面我们就来看看用法2025-03-05
今天汇总15个很值得收藏的DeepSeek 提示词,包含职场打工人必备,自媒体爆款创作,学生党逆袭,个人成长开挂等等全方面2025-03-04
如何在iPhone上部署DeepSeek-R1? DeepSeek-R1在手机上部署全攻略
你以为只在大机器上跑的模型,其实在手机上也能玩得转!为了体验一下国产模型的魅力,我在苹果手机上部署了DeepSeek-R1 1.5B版,详细步骤如下2025-03-01
我们之前分享了很多DeepSeek安装及本地部署教程,今天我们来看看怎么驯化DeepSeek为自己服务,下面我们就来看看DeepSeek 7天指导手册2025-02-21
手机端本地部署 Deepseek +桌面端 Deepseek 搭建知识库指南
关于 Deepseek,这段时间也传来不少新闻,本文将介绍如何在安卓手机和桌面设备上分别部署本地运行的 Deepseek R1 模型,并搭建知识库,详细如下文2025-02-21
DeepSeek-R1 与 AnythingLLM 安装部署本地知识库详细教程
DeepSeek R1是目前最火的大模型,近来有很多朋友问怎么搭建DeepSeek 本地知识库,在这里分享一种使用DeepSeek + AnythingLLM快速搭建本地知识库的方法,完全本地化,懒人必2025-02-20
DeepSeek怎么获取官方API? 一文教会你获取DeepSeek官方API技巧
想要体验DeepSeek,该怎么货期官方API呢?下面我们就来看看获取DeepSeek官方API的详细图文教程2025-02-12
DeepSeek怎么一秒生成工作表目录? DeepSeek办公自动化的技巧
面对日益增长的数据量和复杂多变的业务需求,传统的Excel操作方式在效率和灵活性上逐渐显露出不足,如果接入DeepSeek就可以补足缺陷,详细请看下文介绍2025-02-12
DeepSeek入门必备技巧与隐藏功能! DeepSeek新手使用指南
几乎一夜之间,所有人都在关注DeepSeek,今天就来聊一聊DeepSeek,从什么是DeepSeek开始,到火爆原因,怎么下载使用,以及使用场合和隐藏功能分享,详细如下2025-02-12
DeepSeek卡顿延迟问题怎么解决? 流畅使用DeepSeek的方法大全
由于deepseek人气越来越高,让越来越多人开始使用deepseek,另一方面由于前阵子登录热搜的外网网络攻击,导致用户在使用时常常还没说几句话,就出现服务器繁忙字样,或使用2025-02-12





最新评论