?? update.asp
字號:
<%@ CODEPAGE = "936" %>
<!--#include file="inc_config.asp"-->
<!--#include file="inc_menu.asp"-->
<%
'=================================
'
' 阿江酷站訪問統計系統
' Ajiang info@ajiang.net
' www.ajiang.net
'
' 版權所有·抄襲挪用必究
'
'=================================
%>
<%
if session.Contents("master") <> true then Response.Redirect "help.asp?error=你不是管理員,無權進入本頁面。"
'****************** 創建數據對象 ******************
set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath(connpath)
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
Set rs = Server.CreateObject("ADODB.Recordset")
set connip=server.createobject("adodb.connection")
DBPath = Server.MapPath(ipconnpath)
connip.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
Set rsip = Server.CreateObject("ADODB.Recordset")
if Request("type")="go" then
tall=clng(Request("tall"))
'如果有“啟動”標記,則創建up_date字段并全部標記為未更新。
if Request("start")="yes" then
'on error resume next
sql="select count(*) as tall from view where vwhere='未知'"
temprs=conn.Execute(sql)
tall=temprs("tall")
set temprs=nothing
sql="ALTER TABLE view ADD COLUMN up_date bit"
conn.execute(sql)
sql="update view set up_date=0"
conn.execute(sql)
elseif tall=0 then
sql="select count(*) as tall from view where vwhere='未知' and up_date=0"
temprs=conn.Execute(sql)
tall=temprs("tall")
set temprs=nothing
end if
'****************** 更新主數據庫 ******************
on error resume next
sql="select top 50 * from view where vwhere='未知' and up_date=0"
rs.Open sql,conn,3,2
if rs.EOF then
rs.Close
sql="ALTER TABLE view drop up_date"
conn.execute(sql)
Response.Write "完成"
else
do while not rs.EOF
rs("vwhere")=cadd(rs("vip"))
rs("up_date")=1
rs.Update
rs.MoveNext
loop
rs.Close
sql="select count(*) as thavenot from view where vwhere='未知' and up_date=0"
temprs=conn.Execute(sql)
thavenot=temprs("thavenot")
thave=tall-thavenot
ttlong=int(thave*300/tall)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=countname%>-更新主數據庫</title>
<LINK rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="refresh" content="1; url='update.asp?type=go&tall=<%=tall%>'">
</head>
<body>
<center>
<br>更 新 進 度<br><br>
<table width="304" cellspacing="1" align="center" cellpadding="0" border="0" class=backs>
<tr>
<td align=center>
<table width="300" cellspacing="1" align="center" cellpadding="0" border="0" class=backq>
<tr height=15>
<td align=center width="<%=ttlong%>" class=backs>
</td>
<td align=center width="<%=300-ttlong%>" bgcolor=white>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>已更新/所有: <font class=fonts><%=thave%></font>/<%=tall%>
<br>
如果程序沒有繼續進行,請點擊→[<a href=update.asp?type=go&tall=<%=tall%>>繼續</a>]
<br>如果要暫停這一次更新,請點擊→[<a href="master.asp">暫停</a>]
<br><br>登錄進入更新頁面,點擊“繼續上次未完成的更新”即可繼續本次更新。
</center>
</body>
</html>
<%
end if
else '如果type<>go
%>
本頁功能是用新的IP庫更新主記錄庫,請從管理員頁面進入,誤闖無罪。
<%
end if
'****************** 關閉數據對象 ******************
set rs=nothing
conn.Close
set conn=nothing
set rsip=nothing
connip.Close
set connip=nothing
'****************** 自定義函數 ********************
function cadd(sip)
ipnow=cip(sip)
sql="select * from ip where (onip<=" & ipnow & " and offip>=" & ipnow & ")"
rsip.Open sql,connip,1,1
if rsip.EOF then
cadd="未知"
else
cadd=rsip("addj")
end if
rsip.Close
end function
function cip(sip)
tip=cstr(sip)
sip1=left(tip,cint(instr(tip,".")-1))
tip=mid(tip,cint(instr(tip,".")+1))
sip2=left(tip,cint(instr(tip,".")-1))
tip=mid(tip,cint(instr(tip,".")+1))
sip3=left(tip,cint(instr(tip,".")-1))
sip4=mid(tip,cint(instr(tip,".")+1))
cip=cint(sip1)*256*256*256+cint(sip2)*256*256+cint(sip3)*256+cint(sip4)
end function
function islast()
islast=true
on error resume next
sql="select * from view where up_date=0"
conn.execute(sql)
if err<>0 then islast=false
end function
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -