📄 admin_backupdata.asp
字号:
<!--#include file="config.asp"-->
<%
dim founderr,errmsg
founderr=false
errmsg=""
if session("adminlogin")<>sessionvar then
founderr=true
errmsg=errmsg+"<br>"+"<li>你尚未登录,或者超时了!请<a href='index.asp'>重新登录</a>!"
call diserror()
response.end
end if
if session("flag")>1 then
errmsg=errmsg+"<br>"+"<li>你的管理权限不够!!</a>!"
call diserror()
response.end
end if
if Request("action")="Backup" then
call backupdata()
else
%>
<html>
<head>
<title>管理中心</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK REL="stylesheet" HREF="css.css" TYPE="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" MARGINHEIGHT="0"><script>if(top==self)top.location="index.asp" </script>
<br><script>if(top==self)top.location="index.asp" </script>
<table align="center" width="96%" border="1" cellspacing="0" cellpadding="1" bgcolor="#ffffff" bordercolor="#0099CF" style="border-collapse: collapse">
<form action="" name="form1" method="post">
<tr>
<td height="25" colspan="2" align="center" bgcolor="#0099CF"><b>备 份 整 站 数 据 库 </b> </td>
</tr>
<tr valign="middle">
<td><br>
<B>备份数据</B>( 需要FSO支持,FSO相关帮助请看微软网站 )
<form method="post" action="admin_BackupData.asp">
<br> 当前数据库路径(相对路径):
<input type=text size=20 name=DBpath value=<%=mdb%> class="smallInput">
<BR>
备份数据库目录(相对路径):
<input type=text size=20 name=bkfolder value="../DataBackup" class="smallInput">
如目录不存在,程序将自动创建<BR>
备份数据库名称(填写名称):
<input type=text size=20 name=bkDBname value="data.mdb" class="smallInput">
如备份目录有该文件,将覆盖,如没有,将自动创建<BR>
<input type=submit value="确定备份" class="button">
<br>
-----------------------------------------------------------------------------------------<br>
在上面填写本程序的数据库路径全名,本程序的默认数据库文件为data.mdb<br>
您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>
注意:所有路径都是相对与程序空间Data目录的相对路径 </font>
<input type="hidden" name="action" value="Backup">
</form>
<%end if%>
<%
sub backupdata()
Dbpath=request.form("Dbpath")
Dbpath=server.mappath(Dbpath)
bkfolder=request.form("bkfolder")
bkdbname=request.form("bkdbname")
Set Fso=server.createobject(""&fsoset&"")
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
errmsg="<li>成功备份数据!"
call disok()
Else
errmsg="备份数据库失败,您要备份的数据库不存在"
call diserror()
End if
end sub
'------------------检查某一目录是否存在-------------------
Function CheckDir(FolderPath)
folderpath=Server.MapPath(".")&"\"&folderpath
Set fso1 = CreateObject(""&fsoset&"")
If fso1.FolderExists(FolderPath) then
'存在
CheckDir = True
Else
'不存在
CheckDir = False
End if
Set fso1 = nothing
End Function
'-------------根据指定名称生成目录---------
Function MakeNewsDir(foldername)
Set fso1 = CreateObject(""&fsoset&"")
Set f = fso1.CreateFolder(foldername)
MakeNewsDir = True
Set fso1 = nothing
End Function
%>
</td>
</tr>
</table>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -