复制代码 代码如下: <% Server.ScriptTimeOut=999 min=0 ""开始数 max=260262""结束数 数据数量-1 Dim Conn Set Conn= Server.CreateObject("ADODB.Connection") Conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=01;Data Source="& Server.MapPath("ipaddress.mdb") Conn.Open If Err Then Err.Clear Set Conn = Nothing Response.Write("<head><meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"" /><title>数据库连接出错,请检查连接字串</title></head><body><div align=""center"" style=""width:400px;height:100px;padding: 8px;font-size:9pt;border: 1px solid ThreeDShadow;POSITION:absolute;top:expression((document.body.offsetHeight-100)/2);left:expression((document.body.offsetWidth-400)/2);""><table width=""100%"" height=""100%"" style=""font-size:12px;font-family:Tahoma;""><tr><td align=""center""><strong>数据库连接出错,请检查连接字串</strong></td></tr></table></div></body>") 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 %>