?? admin_backup.asp
字號:
<%
'==================================
'=文 件 名:admin_backup.asp
'=適用版本:游戲天府WAP網站管理系統(CMS)V1.1
'=官方版權:http://www.gotf.cn
'=文件功能:數據庫文件的備份
'=文件作者:游戲天府
'=發行時間:2007-02-01
'==================================
%>
<!--#include file="wapls_admin_conn.asp"-->
<!--#include file="wapls_admin_top.asp"-->
<%
if session("wapls_adminlogin")<>wapls_sessionvar then
errmsg="您沒有登陸或不是管理員。請登陸。"
response.write "<script>window.alert('"&errmsg&"');window.location='admin_login.asp';</script>"
response.End
elseif cur_adminsuper<>1 then
errmsg=""&cur_adminname&",您不是超級管理員,沒有權限進行此操作!"
response.write "<script>window.alert('"&errmsg&"');window.location='javascript:history.go(-1);';</script>"
response.End
end if
dim bkfolder,bkdbname,fso,folderpath,fso1,f
call main()
sub main()
if request("action")="Backup" then
call backupdata()
else
%>
<table cellspacing="1" cellpadding="4" align="center" class="tableborder" align="center">
<tr class="tablebody">
<td class="td_title" align="center">備 份 數 據 庫 !!!</td>
</tr>
<tr class="tablebody">
<td style="line-height:150%"><font color="#FF0000">注意:</font><br>
1、備份數據需要FSO組件支持,FSO組件的相關幫助!所有路徑都是相對與程序空間根目錄的相對路徑!此功能謹慎使用,可能在有些空間備份后,在本機上不能用ACCESS打開。<br>
2、如果備份目錄不存在,程序將自動創建!<br>
3、如果備份目錄有該文件,將覆蓋,如果沒有,程序將自動創建!<br>
4、數據庫備份操作適合于此時不便于使用FTP操作的情況下的在線備份,如果有條件,盡量利用FTP備份到本地。<br>
5、在進行數據庫壓縮之前,請先作備份處理。<br>
6、在進入此操作前,請確定網站現處于<font color="blue">維護狀態</font>!
<br>
<form method="post" name="backupdb" action="admin_backup.asp?action=Backup" onsubmit="return checkform()">
<input type="hidden" name="DBpath" value="<%=db%>">
<%
qqq=split(db,"/")
backupdir=qqq(0)&"/"&qqq(1)
%>
<input type="hidden" size="24" name="bkfolder" value="<%=backupdir%>/Backup<%=year(date)%>-<%=month(date)%>#data">
<br>
<p align="center"><input type="submit" name="submit" value="開始備份"></p><br></td>
</tr>
<tr class="tablebody">
<td>您可以用這個功能來備份您的數據庫,以保證數據的安全!</td>
</tr>
</form>
</table>
<script>
function checkform()
{
document.backupdb.submit.disabled=true;
document.backupdb.submit.value="已提交";
return true;
}
var b=2;
document.backupdb.submit.disabled=true;
document.backupdb.submit.value="請確定網站目前處理維護狀態";
for(i=1;i<=b;i++)
{window.setTimeout("update("+i+")",i*1000);}
function update(c){
if(c==b)
{
document.backupdb.submit.disabled=false;
document.backupdb.submit.value="開始備份"
}
else{
a=b-c;
document.backupdb.submit.value="請確定網站目前處理維護狀態";}
}
</script>
<%
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 "<script>"
Response.Write"alert('數據庫備份(原目錄下)完成,請進行其他操作!\n建議使用 FTP 工具將數據庫備份,以保證數據安全');"
Response.Write "</script>"
Response.Write"<script>history.go(-1)</script>"
else
Response.Write "<script>"
Response.Write"alert('找不到您所需要備份的文件!');"
Response.Write "</script>"
Response.Write"<script>history.go(-1)</script>"
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="wapls_admin_bottom.asp"-->
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -