📄 backupdatabase.asp
字号:
<!--#INCLUDE FILE="checklogin1.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<%
set fso=Server.CreateObject("Scripting.FileSystemObject")
session("BackupDatabase")=""
if request.querystring("action")="DelALL" then Call DelDataBase
if fso.FolderExists(Server.Mappath("BackupDatabase")) then session("BackupDatabase")="<font color=red>你当前存在没有删除的备份数据!!为了防止他人窃取数据请删除</font><br><a href=BackupDatabase.asp?action=DelALL>点击删除</a>"
Sub DelDataBase()
if fso.FolderExists(Server.Mappath("BackupDatabase")) then
fso.DeleteFolder(Server.Mappath("BackupDatabase"))
end if
End Sub
if request.form("action")="backup" then
DataBasePath=request.form("DataBasePath")
month1=month(now)
if Month1<10 then Month1="0"&Month1
day1=day(now)
if day1<10 then day1="0"&day1
hour1=hour(now)
if hour1<10 then hour1="0"&hour1
minute1=minute(now)
if minute1<10 then minute1="0"&minute1
second1=second(now)
if second1<10 then second1="0"&second1
if request.form("FileName")="" then
FileName=Year(now)&Month1&Day1&Hour1&Minute1&Second1
else
Filename=request.form("FileName")
end if
if fso.FileExists(Server.Mappath(""&DataBasePath&"")) then
if fso.FolderExists(Server.Mappath("BackupDatabase"))=false then fso.CreateFolder(Server.Mappath("BackupDatabase"))
fso.CopyFile(Server.Mappath(""&DataBasePath&"")),(Server.Mappath("BackupDatabase\"&FileName&".mdb"))
session("BackupDatabase")="请下载备份数据库,以便数据丢失之后可以恢复<br><a href=BackupDatabase/"&FileName&".mdb>点击下载</a><br>防止数据被窃取下载完之后请删除<br><a href=BackupDatabase.asp?action=DelALL>点击删除</a>"
else
Call Warn("找不到数据库文件、请检查路径!!")
end if
end if
%>
<head>
<link href="include/site.css" type="text/css" rel="stylesheet">
</head>
<body >
<form name=form method=post action="")>
<p> </p>
<p> </p>
<table width="348" border="0" cellspacing="1" cellpadding="0" align="center" bgcolor="<%=tablebordercolor%>">
<tr valign="middle" bgcolor="<%=tabletitlecolor%>">
<td onMouseOver=this.style.backgroundColor='#FAFBFC'; this.style.cursor='hand'; onMouseOut=this.style.backgroundColor=''; height="16" colspan="7" ><!--#include file = topMenu.htm--></td>
</tr>
<form method=post action="">
<tr valign="middle" bgcolor="<%=tabletitlecolor%>">
<td onMouseOver=this.style.backgroundColor='#FAFBFC'; this.style.cursor='hand'; onMouseOut=this.style.backgroundColor=''; height="60" bgcolor="#FFFFFF" align="center" >当前数据库路径:</td>
<td colspan="6" onMouseOver=this.style.backgroundColor='#FAFBFC'; this.style.cursor='hand'; onMouseOut=this.style.backgroundColor=''; height="60" align="center" bgcolor="#FFFFFF" >
<input type="text" name="DataBasePath" value=data/telephone.mdb>
</td>
</tr>
<tr valign="middle" align="center" bgcolor="<%=tabletitlecolor%>">
<td onMouseOver=this.style.backgroundColor='#FAFBFC'; this.style.cursor='hand'; onMouseOut=this.style.backgroundColor=''; height="60" colspan="7" bgcolor="#FFFFFF" >
<%=session("BackupDatabase")%>
</td>
</tr>
<tr valign="middle" align="center" bgcolor="<%=tabletitlecolor%>">
<td onMouseOver=this.style.backgroundColor='#FAFBFC'; this.style.cursor='hand'; onMouseOut=this.style.backgroundColor=''; height="60" colspan="7" bgcolor="#FFFFFF" >
<p>
<input type="hidden" value="backup" name=action>
<input type="submit" value=" 备 份 ">
</p>
</td>
</tr>
</tr>
</table>
</form>
</body>
</html>
<%Sub Warn(depict)%>
<script luanage=javascript>
history.back()
alert("<%=depict%>")
</script>
<%end Sub%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -