?? 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="#FFFFFF">
<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>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -