<!--#include file="utf-8.asp" -->
<!--#include file="js/Function.asp" -->
<!--#include file="CheckAdmin.asp" --> 
<%
'版权：世纪伟成(http://yidacms.com)
'本信息不会影响您网站的正常访问，无论免费用户或是收费用户请保留这里的信息.
'如果您删除了这里的版权信息,将追究法律责任.

if request("yidacms")="bak" Then
Set fs = Server.CreateObject("Scripting.FileSystemObject")
SFile = Server.MapPath(""&webpath&"yidacmsDB/"&dbname&"")
TFile = Server.MapPath(""&webpath&"yidacmsDB/bak/#"&date&".asp")
bakSFile()
elseif request("yidacms")="recovery" Then
Set fs = Server.CreateObject("Scripting.FileSystemObject")
b = request("mdbname")
yidacms_mdbname = replace(b,"@","#")
SFile = Server.MapPath(""&webpath&"yidacmsDB/bak/"&yidacms_mdbname&"")
TFile = Server.MapPath(""&webpath&"yidacmsDB/"&dbname&"")
bakSFile()
end if

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META NAME="copyright" CONTENT="Copyright 2010-2012 - yidacms.com" />
<META NAME="Author" CONTENT="世纪伟成  yidacms.com" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="js/admin.css" rel="stylesheet" type="text/css">
<title>数据库操作</title>
<table width="98%" border="1" cellpadding="6" cellspacing="0" bordercolor="#cccccc" style="border-collapse:collapse" bgcolor="ffffff" align="center">
<form id="form1" name="form1" method="post" action="admin_bak.asp?yidacms=bak">
  <tr>
    <td colspan="3"><div align="right"><input type="submit" name="Submit" value="备份数据库" class="inanniu"/></div></td>
  </tr>
</form>
  <tr>
    <td><div align="center">ID</div></td>
    <td><div align="center">数据库名</div></td>
    <td><div align="center">操作</div></td>
  </tr>
<% 
Dim objFSO,objFolder,objFile,FF,i
FF = Server.MapPath(webpath & "yidacmsDB/bak/")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 
If objFSO.FolderExists(ff) Then 
Set objFolder = objFSO.GetFolder(ff)
i = 1 
For Each objFile in objFolder.Files
a = objFile.Name
yidacms_bakname = replace(a,"#","@")
%>
  <tr>
    <td><div align="center">&nbsp;<%=i%></div></td>
    <td><div align="center">&nbsp;<%=objFile.Name%></div></td>
    <td><div align="center">&nbsp;<input type=button onclick="window.location.href('admin_bak.asp?yidacms=recovery&mdbname=<%=yidacms_bakname%>')" value="恢复此备份" class="inanniu"> <input type=button onclick="window.location.href('admin_bak.asp?yidacms=bakdel&mdbname=<%=yidacms_bakname%>')" value="删 除" class="inanniu"></div></td>
  </tr>
<%	i = i + 1
	Next 
		Else 
	Response.Write "文件夹"&ff&"不存在，无法读取相关信息！" 
End If 
Set objFolder = Nothing 
Set objFSO = Nothing

if request("yidacms")="bakdel" Then
Set fs = Server.CreateObject("Scripting.FileSystemObject")
c = request("mdbname")
yidacms_mdbname1 = replace(c,"@","#")
File = Server.MapPath(webpath & "yidacmsDB/bak/"&yidacms_mdbname1&"")
on Error Resume Next
fs.DeleteFile File, True
If Err.Number = 53 Then
	Response.Write File & "文件不存在! <a href='admin_bak.asp'>返回</a>"
	Response.End
		Elseif Err.Number = 70 Then
	Response.Write File & "文件属性为只读! <a href='admin_bak.asp'>返回</a>"
	Response.End
		Elseif Err.Number <> 0 Then
	Response.Write "未知错误，错误编码：" & Err.Number & " <a href='admin_bak.asp'>返回</a>"
	Response.End
		Else
	Response.Write "<script language=javascript> alert('删除成功!');history.back(-1);</script>" & File
End If
end if
%>
</table>
</body>
</html>