📄 backup.asp
字号:
<!--#include file="users.asp" -->
<!--#include file="jl.asp" -->
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="style.css">
<title>备份数据库</title>
<body text="#000000" link="#000000" vlink="#000000" alink="#000000" bgcolor="#0066FF">
<%
dim bkfolder
dim bkdbname
dim fso
dim folderpath,fso1,f
call main()
conn.close
set conn=nothing
sub main()
%>
<p> </p>
<p> </p>
<center>
<%
if request("action")="Backup" then
call backupdata()
else
%>
<table border="1" cellpadding="6" cellspacing="0" style="border-collapse: collapse" bordercolor="#000000" width="80%" bgcolor="#CCCCCC">
<tr>
<td width="100%" bgcolor="#666666" align="center" height="30" bordercolor="#333333"><b>
<font color="#FFFFFF">备份数据库</font></b></td>
</tr>
<tr>
<td width="100%">
<font color="#FF0000">注意:</font>备份数据需要FSO组件支持,FSO组件的相关帮助请看微软网站!<br> 所有路径都是相对与程序空间根目录的相对路径!</td>
</tr>
<tr><form method="post" action="Backup.asp?action=Backup">
<td width="100%"><br>
当前数据库路径:
<input type=text size=24 name=DBpath value="../db/db.mdb">
请正确添写您当前使用的数据库路径!<BR> 备份数据库目录:<input type=text size=24 name=bkfolder value=../backup> 如果目录不存在,程序将自动创建!<BR> 备份数据库名称:
<input type=text size=24 name=bkDBname value=db.mdb>
如果备份目录有该文件,将覆盖,如果没有,程序将自动创建!<br><br>
<input type=submit value="开始备份"></td>
</tr>
<tr>
<td width="100%"> 在上面填写数据库路径及数据库完整名称,程序的默认数据库文件为<br>
您可以用这个功能来备份您的数据库,以保证数据的安全!<br> <font color="#FF0000">注:此功能谨慎使用,可能在
有些空间备份后,在本机上不能用ACCESS打开。</font></td>
</tr></form>
</table>
<%
end if
%>
</center>
<%
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 + -