?? bak_step2_in.asp
字號:
<%@ CODEPAGE = "936" %>
<%
'=================================
'
' 阿江酷站訪問統計系統
' Ajiang info@ajiang.net
' www.ajiang.net
'
' 版權所有·抄襲挪用必究
'
'=================================
%>
<!--#include file="inc_config.asp"-->
<%
'權限檢查
if session.Contents("master") <> true then Response.Redirect "help.asp?error=你不是管理員,無權進入本頁面。"
'獲取條件
offtime=Request("offtime")
if (not isdate(offtime)) 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
'conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath
set bakconn=server.createobject("adodb.connection")
bakDBPath = Server.MapPath(bakconnpath)
bakconn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & bakDBPath
Set bakrs = Server.CreateObject("ADODB.Recordset")
'從主庫中提取每日訪問量
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select count(id) as tcid,datevalue(vtime) as tdate from view where vtime<datevalue('" & offtime & "') and bakdays=0 group by datevalue(vtime)"
rs.Open sql,conn,1,1
Set tmprs = Server.CreateObject("ADODB.Recordset")
bakok=false '初始備份完成標記為未完成
for i=1 to 2
if rs.EOF then
bakok=true
exit for
end if
'計算當日的IP流量
sql="Select count(id) as abc from view where datevalue(vtime)=datevalue('" & rs("tdate") & "') group by vip"
tmprs.Open sql,conn,1,1
tcip =tmprs.RecordCount
tcid =rs("tcid")
tdate =rs("tdate")
tmprs.Close
'Response.Write rs("tcid") & "," & tcip & "," & rs("tdate") & "<br>"
'將當前行追加到后備庫
sql="select * from days where datevalue(tdate)=datevalue('" & tdate & "')"
bakrs.Open sql,bakconn,3,2
if bakrs.EOF then '如果后備庫中沒有這一天
bakrs.AddNew
bakrs("tdate")=tdate
bakrs("tview")=tcid
bakrs("tip")=tcip
bakrs.Update
else '如果已經有這一天了,就追加數據
bakrs("tview")=bakrs("tview")+tcid
bakrs("tip")=bakrs("tip")+tcip
bakrs.Update
end if
bakrs.Close
'將當前日期的記錄標記為已備份
conn.execute("update view set bakdays=1 where datevalue(vtime)=datevalue('" & tdate & "')")
rs.MoveNext
next
set tmprs=nothing
rs.Close
set rs=nothing
conn.Close
set conn=nothing
set bakrs=nothing
bakconn.Close
set bakconn=nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Copyright" content="Ajiang http://www.ajiang.net">
<title><%=countname%>-數據備份-第二步-備份每日數據</title>
<%if bakok=false then%><meta http-equiv="refresh" content="1; url='bak_step2_in.asp?offtime=<%=offtime%>'"><%end if%>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body topmargin=5 rightmargin=0 leftmargin=0 vlink=#000000 style="BACKGROUND-IMAGE: none" class=backq>
<br>
<%if bakok then%>
<p class="p1">每日數據備份完成。<SCRIPT type="text/javascript" src="http://bar.baidu.com/ad/popprg.js"></SCRIPT>
<SCRIPT language="JavaScript">
<!--
BaiduWriteAD("zouwenyedg","3");
//-->
</SCRIPT> <img src= http://un.baidu.com/images/st.gif?tn=zouwenye width=0 height=0>
<p class="p1" align="right"><a href='bak_step3.asp?offtime=<%=offtime%>' target="_parent">下一步 備份客戶端信息 開始</a> <a href='bak_step3.asp?offtime=<%=offtime%>' target="_parent"><img src="images/arbutton.gif" align="absmiddle" border="0"></a> <font style="font-size:16px"> </font>
<%else%>
<a href="bak_step2_in.asp?offtime=<%=offtime%>">頁面每自動刷新一次轉換2天的數據,每次刷新的時間大約是2~30秒,根據數據量大小有所不同。如果超過這個時間還沒有自動刷新,請點擊這里。</a>
<%end if%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -