📄 backup.asp
字号:
<!--#include file="chk.asp"-->
<html><head><title>数据备份</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="style.css" rel=stylesheet type=text/css>
</head>
<body>
<!--#include file="TopManu.asp"-->
<%
dim bkfolder
dim bkdbname
dim fso
dim folderpath,fso1,f
call main()
sub main()
%>
<%
if request("action")="Backup" then
call backupdata()
else
%>
<div align="center">
<table border="0" width="100%" id="table1" cellspacing="0" style="border-collapse: collapse" cellpadding="0">
<tr>
<td background="image/admintoptdbg.gif">
<p align="left">
<img border="0" src="image/title_arrow.bmp" width="17" height="27" align="absmiddle"><font color="#808080"><b>备份数据库</b></font></td>
</tr>
</table>
<table class="tableBorder" width="100%" border="1" cellpadding="4" cellspacing="0" style="border:1px solid #C0C0C0; border-collapse: collapse; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px" bordercolor="#CCCCCC">
<tr>
<td width="100%" bgcolor="#F7F7F7">
<font color="#FF0000">注意:注意:备份数据需要FSO组件支持,FSO组件的相关帮助!所有路径都是相对与程序空间根目录的相对路径!此功能谨慎使用,可能在有些空间备份后,在本机上不能用ACCESS打开。</font></td>
</tr>
<tr><form method="post" action="Backup.asp?action=Backup">
<td width="100%" bgcolor="#F7F7F7">
当前数据库路径:<input type=text size=24 name=DBpath value="../byfenglan#/byfenglanAC.mdb">
请正确添写您当前使用的数据库路径!<BR>
备份数据库目录:<input type=text size=24 name=bkfolder value=../jj_Databackup>
如果目录不存在,程序将自动创建!<BR>
备份数据库名称:<input type=text size=24 name=bkDBname value=byec_shop.mdb>
如果备份目录有该文件,将覆盖,如果没有,程序将自动创建!<br>
<input type=submit value="开始备份"></td>
</tr>
<tr>
<td width="100%" bgcolor="#F7F7F7">
在上面填写数据库路径及数据库完整名称,程序的默认数据库文件为byec_shop.mdb<br>
您可以用这个功能来备份您的数据库,以保证数据的安全!<br></td>
</tr></form>
</table>
</div>
<table border="0" width="760" id="table3" cellspacing="0" cellpadding="0" align=center>
<tr>
<td align=right><input TYPE="button" VALUE="刷新本页" ONCLICK="location.reload()"> </td>
</tr>
</table>
<%
end if
%>
<%
end sub
sub backupdata()
Dbpath=request.form("Dbpath")
Dbpath=server.mappath(Dbpath)
bkfolder=request.form("bkfolder")
bkdbname=request.form("bkdbname")
Set Fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(dbpath) then
If CheckDir(bkfolder) = True Then
fso.copyfile dbpath,bkfolder& "\"& bkdbname
else
MakeNewsDir bkfolder
fso.copyfile dbpath,bkfolder& "\"& bkdbname
end if
response.write "数据库备份完成,请进行其他操作!<br>建立使用 FTP 工具将数据库备份,以保证数据安全"
else
response.write "找不到您所需要备份的文件!"
end if
end sub
Function CheckDir(FolderPath)
folderpath=Server.MapPath(".")&"\"&folderpath
Set fso1 = CreateObject("Scripting.FileSystemObject")
If fso1.FolderExists(FolderPath) then
CheckDir = True
Else
CheckDir = False
End if
Set fso1 = nothing
End Function
Function MakeNewsDir(foldername)
Set fso1 = CreateObject("Scripting.FileSystemObject")
Set f = fso1.CreateFolder(foldername)
MakeNewsDir = True
Set fso1 = nothing
End Function
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -