📄 admin_databackup.asp
字号:
<!-- #include file="conn.asp"-->
<!--#include file="config.asp"-->
<%
if session("admin")="" then
response.redirect "admin_login.asp"
end if
'13 备份数据库
if not checkflag("13") then
call mb("对不起,您没有备份数据库的权限!","",0)
end if
set rs=nothing
conn.close
set conn=nothing
if request("action")="Backup" then
dim bkfolder,bkdbname,Fso,fso1,f
call backupdata()
else
%>
<link href="style.css" rel="stylesheet" type="text/css">
<body leftmargin="5" topmargin="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="#000000" vspace="0" hspace="0">
<tr bgcolor="#EFEBEF">
<td height="27"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="86%"><font color="#FF3000">.:: 您可以在这里进行[ACCESS数据库]相关操作</font></td>
<td width="14%" height="20" align="center"><a href="javascript:this.location.reload()"><img src="images/refresh.gif" alt="刷新" width="40" height="12" border="0"></a></td>
</tr>
</table></td>
</tr>
<tr >
<td height="1" bgcolor="#000000"></td>
</tr>
</table>
<form method="post" action="admin_DataBackup.asp?action=Backup">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" Class="TableLine" >
<tr bgcolor="#FFFFFF">
<td height="30" colspan="2" align="center" valign="middle" ><b>数据库备份</b></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="16%" height="30" align="center">备份目录:<BR>
</td>
<td width="84%" height="30">
<input name=bkfolder type=text class="input" value=Databackup size=20>
相对路径目录,如目录不存在,将自动创建</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="30" align="center">备份名称:</td>
<td height="30">
<input name=bkDBname type=text class="input" value="<%=(makepassword(7)&date())%>" size=25> <br>
不用输入文件名后缀(默认为“.asp”)。如有同名文件,将覆盖,请记住该文件名。</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="30" colspan="2" align="center">
<input name="submit" type=submit class="button" value=" 确定备份 "></td>
</tr>
</table>
</form>
<p> </p>
<p align=center><font color="#FF0000">本系统需要您的服务器支持FSO,请确认您的服务器符合要求。</font></p>
<%
end if
sub backupdata()
bkfolder=request.form("bkfolder")
bkdbname=request.form("bkdbname")
if bkdbname="" then bkdbname=date()
Set Fso=server.createobject("scripting.filesystemobject")
dbpath=server.mappath(dbpath) '把虚拟路径转化为真实路径
if fso.fileexists(dbpath) then
If CheckDir(bkfolder) = True Then
fso.copyfile dbpath,bkfolder& "\"& bkdbname &".asp"
else
MakeNewsDir bkfolder
fso.copyfile dbpath,bkfolder& "\"& bkdbname &".asp"
end if
response.write "<center>备份数据库成功,备份的数据库为 " &bkfolder& "\"& bkdbname&".asp</center>"
Else
response.write "<center>找不到源数据库文件。</center>"
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
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -