📄 admin_data.asp
字号:
<%
if session("AdminName")="" then
response.redirect "index.asp"
end if
%>
<!--#include file="inc/conn.inc"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="admin_style.css" rel="stylesheet" type="text/css">
<table width="57%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#326598" bordercolordark="#ffffff">
<tr>
<td height="25" align="center" background="image/tile_sub.gif" class="a1"><strong>备份数据库</strong></td>
</tr>
<tr>
<td align="center">
<%
if request("action")="Backup" then
call backupdata()
else
%>
<table width="426" height="314" border="0" align="center" cellpadding="0" cellspacing="0">
<form method="post" action="admin_data.asp?action=Backup"><tr>
<td height="25"><BR></td>
</tr>
<tr>
<td height="22"> 当前数据库路径</td>
</tr>
<tr>
<td height="22"><input type=text size=50 name=DBpath value="<%=db%>" class="input"></td>
</tr>
<tr>
<td height="22"> 备份数据库目录[如目录不存在,程序将自动创建]</td>
</tr>
<tr>
<td height="22"><input type=text size=50 name=bkfolder value=Databackup class="input"></td>
</tr>
<tr>
<td height="22">备份数据库名称[如备份目录有该文件,将覆盖,如没有,将自动创建]</td>
</tr>
<tr>
<td height="22"><input name=bkDBname type=text class="input" value=data_backup.mdb size=30></td>
</tr>
<tr>
<td height="22"><div align="center">
<input type=submit value="确定" class="input">
</div></td>
</tr></form>
</table>
<%end if%><%
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 "备份数据库成功,您备份的数据库路径为" &bkfolder& "\"& bkdbname
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
%>
</td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -