📄 admin_backdb.asp
字号:
<%@ codepage ="936" %>
<%dbdns="../../"%>
<!--#include file="../../inc/conn.asp"-->
<!--#include file="../cook.asp"-->
<%if conttstr="SQL" then
response.write"<body style=""margin:10"">对不起,您使用的是SQL数据库,请您从SQL企业管理器对数据库进行备份"
response.end
end if
if fla12<>1 then
response.write "<script>alert('操作权限出错,您没有权限操作些功能');history.go(-1);</Script>"
Response.End
end if%>
<BODY style="margin:10">
<%=citycss%>
<%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
Dim dbpath,boolIs97
dbpath=request.form("mdbpath")
boolIs97=request.form("ys")
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
Const JET_3X = 4
Function CompactDB(dbPath, boolIs97)
Dim fso, Engine, strDBPath
strDBPath = left(dbPath,instrrev(DBPath,"\"))
set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(dbPath) Then
set Engine = CreateObject("JRO.JetEngine")
If boolIs97 = "true" Then
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb;" _
& "Jet OLEDB:Engine Type=" & JET_3X
Else
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb"
End If
fso.CopyFile strDBPath & "temp.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")
set fso = nothing
set Engine = nothing
response.write"<script>alert('您的数据库已经压缩成功!');history.go(-1)</script>"
response.End()
Else
response.write"<script>alert('数据库名称或路径不正确. 请重试!');history.go(-1)</script>"
response.End()
End If
End Function
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
db=replace(scadb,left(right(scadb,len(scadb)-(InstrRev(scadb,"/"))),len(right(scadb,len(scadb)-(InstrRev(scadb,"/"))))-(len(scadb)-InstrRev(scadb,".")+1)),"*")
%>
<form name="form1" method="POST" action="admin_backdb.asp?action=back">
<table width="100%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolorlight="#cccccc" bordercolordark="#FFFFFF">
<tr>
<td bgcolor="#efefef" height=25><strong>备份数据库</strong></td>
</tr>
<tr>
<td height=25>你的空间只有支持fso才可以进行如下操作,否则你只能手动备份</td>
</tr>
<tr>
<td height=25>数据库路径:
<input type="text" name="currf" size="30" value="<%=db%>"></span> 备份数据目录:
<input type="text" name="backf" size="20" value="mdbback"></td>
</tr>
<tr>
<td height=25>数据库名称:
<input type="text" name="backfy" size="20" value="back.asp">
<input type="submit" name="Submit" value="备份" >
<input type="reset" name="Submit2" value="重置" >
</td>
</tr>
</table>
</form>
<form name="form1" method="POST" action=admin_backdb.asp?action=ys>
<table width="100%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolorlight="#cccccc" bordercolordark="#FFFFFF">
<tr>
<td bgcolor="#efefef" height=25><strong>压缩数据库</strong></td>
</tr>
<tr>
<td height=25>你的空间只有支持fso才可以进行如下操作,否则你只能手动压缩</td>
</tr>
<tr>
<td height=25>数据库路径:<input type="text" name="mdbpath" size="20" value="mdbback/back.asp">
<input type="submit" name="Submit" value="压缩" >
<input type="reset" name="Submit2" value="重置" > <input type="radio" value="true" name="ys">使用
Access 97 数据库<input type="radio" value="false" checked name="ys">使用 Access
2000 数据库</td>
</tr>
<tr>
<td height=25>(为了安全,请注意用备份的数据库文件来压缩,不要用当前正在运行的数据库文件)</td>
</tr>
</table>
</form>
<form name="form1" method="POST" action="admin_backdb.asp?action=reload">
<table width="100%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolorlight="#cccccc" bordercolordark="#FFFFFF">
<tr>
<td bgcolor="#efefef" height=25><strong>恢复数据库</strong></td>
</tr>
<tr>
<td height=25>你的空间只有支持fso才可以进行如下操作,否则你只能手动恢复</td>
</tr>
<tr>
<td height=25>当前数据库路径:<input type="text" name="currf" size="30" value="<%=db%>"> 备份数据库路径:<input type="text" name="backf" size="20" value="mdbback/back.asp">
<input type="submit" name="Submit" value="恢复" >
<input type="reset" name="Submit2" value="重置" >
</td>
</tr>
</table>
</form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -