📄 admin_compress.asp
字号:
<%
'==================================
'=文 件 名:admin_compress.asp
'=适用版本:游戏天府WAP网站管理系统(CMS)V1.1
'=官方版权:http://www.gotf.cn
'=文件功能:数据库文件压缩管理
'=文件作者:游戏天府
'=发行时间:2007-02-01
'==================================
%>
<!--#include file="wapls_admin_conn.asp"-->
<!--#include file="wapls_admin_top.asp"-->
<%
if session("wapls_adminlogin")<>wapls_sessionvar then
errmsg="您没有登陆或不是管理员。请登陆。"
response.write "<script>window.alert('"&errmsg&"');window.location='admin_login.asp';</script>"
response.End
elseif cur_adminsuper<>1 then
errmsg=""&cur_adminname&",您不是超级管理员,没有权限进行此操作!"
response.write "<script>window.alert('"&errmsg&"');window.location='javascript:history.go(-1);';</script>"
response.End
end if
'=====================压缩参数=========================
Function CompactDB(dbPath, boolIs97)
Dim fso, Engine, strDBPath,JET_3X
strDBPath = left(dbPath,instrrev(DBPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(dbPath) Then
fso.CopyFile dbpath,strDBPath & "temp.mdb"
Set Engine = CreateObject("JRO.JetEngine")
If boolIs97 = "True" Then
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb;" _
& "Jet OLEDB:Engine Type=" & JET_3X
Else
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb"
End If
fso.CopyFile strDBPath & "temp1.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")
fso.DeleteFile(strDBPath & "temp1.mdb")
Set fso = nothing
Set Engine = nothing
Response.Write "<script>"
Response.Write"alert('数据库在线实时压缩完毕,请进行其他操作!\n如压缩后的数据库不正常,请利用FTP使用备份数据库!');"
Response.Write "</script>"
Response.Write"<script>history.go(-1)</script>"
'CompactDB = "你的数据库【" & dbpath & "】已经压缩成功!" & vbCrLf
Else
Response.Write "<script>"
Response.Write"alert('数据库名称或路径不正确. 请重试!');"
Response.Write "</script>"
Response.Write"<script>history.go(-1)</script>"
End If
End Function
%>
<table cellspacing="1" cellpadding="4" align="center" class="tableborder" align="center">
<tr class="tablebody">
<td class="td_title" align="center">压缩数据库 ( 需要FSO支持,FSO相关帮助请看微软网站 ) </td>
</tr>
<tr class="tablebody">
<td style="line-height:150%"><span class="current_font">注意:</span><br>
①、输入数据库所在相对路径,并且输入数据库名称(正在使用中数据库不能压缩,请选择备份数据库进行压缩操作)<br>
②、为确保数据库安全,不出现暴库,在压缩数据库之前,请务必作好备份,并且网站状态要在<a href="admin_config.asp"><strong>维护状态</strong></a>(设置好维护状态后,等上几分钟,以确保所有用户都已断开)!<br><br>
<form name="compress" method="post" action="" onsubmit="return checkform()" >
<input type="hidden" name="dbpath" value="<%=db%>">
<br>
<p align="center"><input type="submit" name="submit" value="开始压缩"></p><br></td>
</tr>
<tr class="tablebody">
<td><input type="checkbox" name="boolIs97" value="True">如果使用 Access 97 数据库请选择(默认为 Access 2000 数据库)</td>
</tr>
</form>
<script>
function checkform()
{
document.compress.submit.disabled=true;
document.compress.submit.value="已提交";
return true;
}
var b=2;
document.compress.submit.disabled=true;
document.compress.submit.value="请确定网站目前处理维护状态";
for(i=1;i<=b;i++)
{window.setTimeout("update("+i+")",i*1000);}
function update(c){
if(c==b)
{
document.compress.submit.disabled=false;
document.compress.submit.value="开始压缩"
}
else{
a=b-c;
document.compress.submit.value="请确定网站目前处理维护状态";}
}
</script>
<%
Dim dbpath,boolIs97
dbpath = request("dbpath")
boolIs97 = request("boolIs97")
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
%>
</td>
</tr>
</table>
<!--#include file="wapls_admin_bottom.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -