www.gusucode.com > 爱美尔女性商城源码 1.0源码程序 > admintouch/backup.asp

    <!--#include file="conn.asp"-->
<%if session("bjxadmin")="" then
response.Write "<script LANGUAGE='javascript'>alert('网络超时或者您还没有登录请登录');window.location.href='login.asp';</script>"
response.End
else
if session("flag")>2 then
response.Write "<p align=center><font color=red>您没有此项目管理权限!</font></p>"
response.End
end if
end if%>
<html><head><title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
dim bkfolder
dim bkdbname
dim fso
dim folderpath,fso1,f
call main()
conn.close
set conn=nothing
sub main()
%>

<%
if request("action")="Backup" then
call backupdata()
else
%>
<table class="tableBorder" width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#6a7f9a">
<tr> 
<td align="center" background="images/admin_bg_1.gif"><b><font color="#ffffff">备份数据库</font></b></td>
</tr>
<tr>
<td width="100%" >
<font color="#FF0000">注意:注意:备份数据需要FSO组件支持,FSO组件的相关帮助!所有路径都是相对与程序空间根目录的相对路径!此功能谨慎使用,可能在有些空间备份后,在本机上不能用ACCESS打开。</font></td>
</tr>
<tr><form method="post" action="Backup.asp?action=Backup">
<td width="100%" >
当前数据库路径:<input type=text size=24 name=DBpath value="../data/shop.asa"> 
请正确添写您当前使用的数据库路径!<BR>
备份数据库目录:<input type=text size=24 name=bkfolder value=../Databackup>
如果目录不存在,程序将自动创建!<BR>
备份数据库名称:<input type=text size=24 name=bkDBname value=shop.mdb>
如果备份目录有该文件,将覆盖,如果没有,程序将自动创建!<br>
<input type=submit value="开始备份"></td>
</tr>
<tr>
<td width="100%" >
在上面填写数据库路径及数据库完整名称,程序的默认数据库文件为shop.mdb<br>
您可以用这个功能来备份您的数据库,以保证数据的安全!<br></td>
</tr></form>
</table>
<%
end if
%>

<%
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
%>
<!--#include file="bjxfoot.asp"-->
</body>
</html>