📄 admin_dbback.asp
字号:
<!--#include file="conn.asp" -->
<!--#include file="CheckAdmin.asp" -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
-->
</style>
<script language="javascript">
function delok(){
if (confirm("你确定要恢复数据库吗?\n\n恢复数据库可能造成现有的数据丢失!!!\n\n继续吗?")) {
form1.submit();
}
return false;
}
</script>
<BODY topMargin=0 leftmargin="0" marginheight="0">
<link rel="stylesheet" type="text/css" href="../style.css">
<%
'on error resume next
if Request.QueryString("action")="back" then
currf=request.form("currf")
currf= "../../data/"&currf
currf=server.mappath(currf)
backf=request.form("backf")
backf=server.mappath(backf)
backfy=request.form("backfy")
backfy=right(backfy,7)
on error resume next
Set objfso = Server.CreateObject("Scripting.FileSystemObject")
if err then
err.clear
response.write "<div class=tdc>不能建立fso对象,请确保你的空间支持fso:!"
response.end
end if
if objfso.Folderexists(backf) then
else
Set fy=objfso.CreateFolder(backf)
end if
objfso.copyfile currf,backf& "\"& backfy
response.write "<div class=tdc>备份数据库成功,您的数据库备份路径为" &backf& "\"& backfy&"</div>"
response.Write "<a href='javascript:history.back();'>返回</a>"
response.end
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 & "tourtemp.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 & "tourtemp.mdb"
End If
objfso.CopyFile strDBPath & "fytemp.mdb",currf
objfso.DeleteFile(strDBPath & "tourtemp.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="../../data/"&currf
currf=server.mappath(currf)
backf=request.form("backf")
backf=right(backf,7)
backf="dbback/"&backf
if backf="dbback/" or 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
set rs=nothing
%>
<form name="form1" method="POST" action="Admin_dbback.asp?action=back">
<div align="center">
<center>
<br>
<table border="1" cellpadding="5" bordercolorlight="#326598" bordercolordark="#ffffff" width="98%" id="AutoNumber1" cellspacing="0">
<tr>
<td width="100%" height="25" background="../images/admin_bg_1.gif"><font color="#FFFFFF"><strong>备份数据库</strong></font></td>
</tr>
<tr>
<td width="100%" bgcolor="#FBFDFF"><font color="#FF0000">你的空间只有支持fso才可以进行如下操作,否则你只能手动备份</font></td>
</tr>
<tr>
<td width="100%" bgcolor="#FBFDFF">数据库路径:
<span style="background-color: #F7FFF7"><span style="background-color: #F7FFF7">
<select name="currf" id="currf" onChange="backfy.value=currf.value">
<option value="databack.mdb" selected>data.mdb</option>
</select>
</span> </span> 备份数据目录:
<span style="background-color: #F7FFF7">
<input type="text" name="backf" size="20" value="../dbback" readonly></span></td>
</tr>
<tr>
<td width="100%" bgcolor="#FBFDFF">数据库名称:
<span style="background-color: #F7FFF7">
<input type="text" name="backfy" size="20" value="databack.mdb" readonly>
<input type="submit" name="Submit" value="备份" >
<input type="reset" name="Submit2" value="重置" > </span></td>
</tr>
</table>
</center>
</div>
</form>
<form name="form1" method="POST" action=Admin_dbback.asp?action=ys>
<div align="center">
<center>
<table border="1" cellpadding="5" bordercolorlight="#326598" bordercolordark="#ffffff" width="98%" id="AutoNumber2" cellspacing="0">
<tr>
<td width="100%" height="25" background="../images/admin_bg_1.gif"><font color="#FFFFFF"><strong>压缩数据库</strong></font></td>
</tr>
<tr>
<td width="100%">
<span style="background-color: #F7FFF7">你的</span>空间只有支持fso才可以进行如下操作,否则你只能手动压缩</td>
</tr>
<tr>
<td width="100%">
<span style="background-color: #F7FFF7">数</span>据库路径:<span style="background-color: #F7FFF7">
<select name="currf" id="currf">
<option value="dbback/abc.mdb">dbback/abc.mdb</option>
<option value="dbback/db2.mdb" selected>dbback/db2.mdb</option>
</select>
<input type="submit" name="Submit" value="压缩" >
<input type="reset" name="Submit2" value="重置" > </span>
<input type="radio" value="1" name="ys">使用
Access 97 数据库<input type="radio" value="2" checked name="ys">使用 Access
2000 数据库</td>
</tr>
<tr>
<td width="100%"><font color="#FF0000">(为了安全,请注意用备份的数据库文件来压缩,不要用当前正在运行的数据库文件)</font></td>
</tr>
</table>
</center>
</div>
</form>
<form name="form1" method="POST" action="Admin_dbback.asp?action=reload">
<div align="center">
<center>
<table border="1" cellpadding="5" cellspacing="0" bordercolorlight="#326598" bordercolordark="#ffffff" width="98%" id="AutoNumber3">
<tr>
<td width="100%" height="25" background="../images/admin_bg_1.gif"><font color="#FFFFFF"><strong>恢复数据库</strong></font></td>
</tr>
<tr>
<td width="100%"><font color="#FF0000">你的空间只有支持fso才可以进行如下操作,否则你只能手动恢复</font></td>
</tr>
<tr>
<td width="100%">当前数据库路径:<span style="background-color: #F7FFF7">
<span style="background-color: #F7FFF7"><span style="background-color: #F7FFF7">
<select name="currf" id="currf" onChange="backf.value=currf.value">
<option value="abc.mdb">abc.mdb</option>
<option value="foundweb_db2.mdb" selected>foundweb_db2.mdb</option>
</select>
</span></span> </span> 备份数据
库路径:<span style="background-color: #F7FFF7">
<span style="background-color: #F7FFF7">
<input name="backf" type="text" id="backf" value="foundweb_db2.mdb" size="20" readonly>
</span></span>
<span style="background-color: #F7FFF7">
<input type="submit" name="Submit" value="恢复" onClick="return delok()">
<input type="reset" name="Submit2" value="重置"> </span></td>
</tr>
</table>
</center>
</div>
</form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -