📄 admin.asp
字号:
<!--#include file="Connections.asp" -->
<!--#include file="bbs.css" -->
<title><%=hometitle%>统计</title>
<body <%=background%>>
<%if request("view")<>"" then
view=request("view")
url="?view="&view&""
end if
%>
<% if Request.Cookies(feiyuetongji)("Username")="" then
response.Redirect("manage.asp?action=error")
end if
if request("view")<>"" then
view=request("view")
url1="?view="&view&"&"
else
url1="?"
end if%>
<%if Request.QueryString("action")="del" then
sql="delete fid from fcount"
conn.execute(sql)
response.write "<script>alert(""删除完毕"");history.back();</script>"
end if
if Request.QueryString("action")="del1" then
sql="delete fid from fcount"
conn.execute(sql)
sql="update vcount set vtoday=0,vyestaday=0,vtotal=0,vtotal1=0,vnowmonth=0,vpremonth=0,vnowyear=0,vweek=0,vstarttime='"&now()&"',vdate='"&date()&"'"
conn.execute(sql)
response.write "<script>alert(""清空完毕"");history.back();</script>"
end if
if Request.QueryString("action")="back" then
currf=request.form("currf")
currf=server.mappath(currf)
backf=request.form("backf")
backf=server.mappath(backf)
backfy=request.form("backfy")
on error resume next
Set objfso = Server.CreateObject("Scripting.FileSystemObject")
if err then
err.clear
response.write "<script>alert(""不能建立fso对象,请确保你的空间支持fso:!"");history.back();</script>"
response.end
end if
if objfso.Folderexists(backf) then
else
Set fy=objfso.CreateFolder(backf)
end if
objfso.copyfile currf,backf& "\"& backfy
response.write "<script>alert(""备份数据库成功"");history.back();</script>"
end if
if Request.QueryString("action")="ys" then
currf=request.form("currf")
currf = server.mappath(currf)
ys=request.form("ys")
Const JET_3X = 4
strDBPath = left(currf,instrrev(currf,"\"))
on error resume next
Set objfso = Server.CreateObject("Scripting.FileSystemObject")
if err then
err.clear
response.write "<script>alert(""不能建立fso对象,请确保你的空间支持fso:!"");history.back();</script>"
response.end
end if
if objfso.fileexists(currf) then
Set Engine = CreateObject("JRO.JetEngine")
on error resume next
If ys = 1 Then
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & currf, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "fytemp.mdb;" _
& "Jet OLEDB:Engine Type=" & JET_3X
Else
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & currf, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "fytemp.mdb"
End If
objfso.CopyFile strDBPath & "fytemp.mdb",currf
objfso.DeleteFile(strDBPath & "fytemp.mdb")
Set objfso = nothing
Set Engine = nothing
if err then
err.clear
response.write "<script>alert(""错误:很抱歉,由于系统错误,压缩失败:!"");history.back();</script>"
response.end
end if
response.write "<script>alert(""压缩数据库成功"");history.back();</script>"
response.end
Else
response.write "<script>alert(""错误:找不到数据库文件!"");history.back();</script>"
response.end
End If
end if
if Request.QueryString("action")="reload" then
currf=request.form("currf")
currf=server.mappath(currf)
backf=request.form("backf")
if backf="" then
response.write "<script>alert(""请输入您要恢复的数据库全名"");history.back();</script>"
else
backf=server.mappath(backf)
end if
on error resume next
Set objfso = Server.CreateObject("Scripting.FileSystemObject")
if err then
err.clear
response.write "<script>alert(""不能建立fso对象,请确保你的空间支持fso:!"");history.back();</script>"
response.end
end if
if objfso.fileexists(backf) then
objfso.copyfile ""&backf&"",""&currf&""
response.write "<script>alert(""恢复数据库成功"");history.back();</script>"
response.end
else
response.write "<script>alert(""错误:备份目录下无您的备份文件!"");history.back();</script>"
response.end
end if
end if
sql="select count(fweek) as fweek1 from fcount"
set rs=conn.execute(sql)
fcount1=rs("fweek1")
set rs=nothing
%>
<div align="center">
<center>
<table border=1 cellPadding=1 cellSpacing=1 width=760 style="border-collapse: collapse" align=center>
<form name="form2" method="POST" action="admin.asp<%=url1%>action=del" >
<tr align="center">
<td colspan="2" 1 height=22 <%=hColor2%>>删除统计系统下的所有详细资料 | <a href=adminadmin.asp<%=url%>>管理资料更改</a> | <a href=logout.asp<%=url%>>[退出管理]</a></td>
</tr>
<tr>
<td align="right" width="10%" colspan="2">
<p align="center"> <input type="submit" name="Submit" value="删除"><br>
(为了数据库的执行速度,建议你隔段时间就执行此操作,此操作并不会将你的统计资料归零,只是删除了详细记录,但为了安全,建议你最好先备份)
<BR>(当前共有 <%=fcount1%> 条详细资料)</td>
</tr>
</form>
<form name="form2" method="POST" action="admin.asp<%=url1%>action=del1" >
<tr align="center">
<td colspan="2" <%=hColor2%>1 height=22>
将所有统计归零</td>
</tr>
<tr align="center">
<td align="right" width="10%" colspan="2">
<p align="center"> <input type="submit" name="Submit" value="清空"><br>
(此操作将会将所有统计资料归零,请慎重使用)
</td>
</tr>
</form>
<form name="form1" method="POST" action="<%=url1%>action=back">
<tr align="center">
<td colspan="2" <%=hColor2%>1 height=22>
备份数据库</td>
</tr>
<tr align="center">
<td height=22 colspan="2">你的空间只有支持fso才可以进行如下操作,否则你只能手动备份</td>
</tr>
<tr>
<td width="30%" align="right">数据库路径:</td>
<td>
<input type="text" name="currf" size="20" value="<%=feiyuedbq%>"> </td>
</tr>
<tr>
<td width="30%" align="right">备份数据目录:</td>
<td>
<input type="text" name="backf" size="20" value="database/"> </td>
</tr>
<tr>
<td width="30%" align="right">数据库名称:</td>
<td>
<input type="text" name="backfy" size="20" value="<%=FormatDateTime(now(),1)%>.mdb"> </td>
</tr>
<tr>
<td width="20%" align="right"> </td>
<td>
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</td>
</tr>
</form>
<form name="form1" method="POST" action="<%=url1%>action=ys">
<tr align="center">
<td colspan="2" <%=hColor2%>1 height=22>
压缩数据库</td>
</tr>
<tr align="center">
<td height=22 colspan="2">你的空间只有支持fso才可以进行如下操作,否则你只能手动压缩</td>
</tr>
<tr>
<td width="30%" align="right">数据库路径:</td>
<td>
<input type="text" name="currf" size="20" value="database/<%=FormatDateTime(now(),1)%>.mdb">
</td>
</tr>
<tr>
<td width="30%" align="right" colspan="2">
<p align="left"><input type="radio" value="1" name="ys">使用 Access 97 数据库<input type="radio" value="2" checked name="ys">使用
Access 2000 数据库</td>
</tr>
<tr>
<td width="30%" align="right" colspan="2">
<p align="left">(为了安全,请注意用备份的数据库文件来压缩,不要用当前正在运行的数据库文件)</td>
</tr>
<tr>
<td width="20%" align="right"> </td>
<td>
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</td>
</tr>
</form>
<form name="form1" method="POST" action="<%=url1%>action=reload">
<tr align="center">
<td colspan="2" <%=hColor2%>1 height=22>
恢复数据库</td>
</tr>
<tr align="center">
<td height=22 colspan="2">你的空间只有支持fso才可以进行如下操作,否则你只能手动恢复</td>
</tr>
<tr>
<td width="30%" align="right">当前数据库路径:</td>
<td>
<input type="text" name="currf" size="20" value="<%=feiyuedbq%>"> </td>
</tr>
<tr>
<td width="30%" align="right">备份数据路径:</td>
<td>
<input type="text" name="backf" size="20" value="database/<%=FormatDateTime(now(),1)%>.mdb"> </td>
</tr>
<tr>
<td width="20%" align="right"> </td>
<td>
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</td>
</tr>
</form>
</table>
</center>
</div>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -