实现纯真IP txt转mdb数据库的方法(2)
Response.End
End If
set rs=conn.execute("select * from [ipaddress]")
if not rs.eof then
first=rs.GetRows()
for j=0 to 261501
z=""
local=""
for i=0 to 16
if len(first(i,j))>0 then
z=first(i,j)&"$$"&z
end if
next
zz=split(z,"$$")
startip=enaddr(zz(ubound(zz)-1))
endip=enaddr(zz(ubound(zz)-2))
country=zz(ubound(zz)-3)
for zzz=0 to ubound(zz)-4
local=zz(zzz)&" "&local
next
local=replace(local,"'","''")
'response.write "startip:"&startip&"<br>endip:"&endip&"<br>country:"&country&"<br>local:"&local&"<br><br>"
conn.execute("insert into [ipaddress2] (ip1,ip2,country,[city]) values ("&startip&","&endip&",'"&country&"','"&local&"')")
next
end if
conn.execute("update [ipaddress2] set [city]='--' where [city]='CZ88.NET' ")
response.write "升级成功!"
function enaddr(sip)
esip=cstr(sip)
str1=Left(sip,CInt(InStr(sip,".")-1))
sip=Mid(sip,cint(instr(sip,"."))+1)
str2=Left(sip,cint(instr(sip,"."))-1)
sip=mid(sip,cint(instr(sip,"."))+1)
str3=left(sip,cint(instr(sip,"."))-1)
str4=mid(sip,cint(instr(sip,"."))+1)
enaddr=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
end function
%>