<%@ LANGUAGE=VBScript CodePage=936%>
  <% 
	data_path="../" 'ACC连接数据库路径，对SQL无效
	numid="121"
	dir="err.asp" 
  %>
  <!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/filesystem.asp"-->
 <!--#include file="../inc/safe.asp"-->
  <!--#include file="rolecheckout.asp"-->
 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网站信息设置</title>
<LINK href="css/style.css" rel=stylesheet type=text/css>

</head>
<body>
<%
 
 on error resume next
 Const strDBPath = "Databackup"
dim sqlname
sqlname=SqlDatabaseName
dim Action 
Action=Replace_Text(request("Action"))
'数据库备份-----------------------------
if Action="BackupData" then
  on error resume next
 	bkdbname=Replace_Text(request("bkdbname"))	
	  Sql = "backup database "&sqlname&" to disk='"&Server.MapPath("../"&strDBPath&"/"&bkdbname&".dat")&"'"
      conn.execute sql
	if err  then
	msg="备份数据库失败！"
	else
	msg="<table><tr><td>备份数据库成功!<br><br>【地址(相对路径)：<font color=red style='font-size:12px'>"&HOPE_InstallDir&strDBPath&"/"&bkdbname&".dat</font>】<br><br>【地址(绝对路径)：<font color=red style='font-size:12px'>"&Server.MapPath("../"&strDBPath&"/"&bkdbname&".dat")&"</font>】</td></tr></table>"
 	end if
 end if
'---------------------------------------
 ' 删除备份-------
 actiondo=Replace_Text(request("actiondo"))	
 delname=Replace_Text(request("delname"))
 if actiondo="del" and delname<>""  then
 call  FileDel("../"&strDBPath&"/"&delname)
  end if
 
 '------------------
%>

 <table cellpadding="2" cellspacing="1" border="0" width="98%" class="tableBorder" align=center>
  <tr align="center">
    <th height=25 align="center"> <strong>备 份 数 据 库(mssql)</strong> 
  </tr>
  <tr><td height="25" bgcolor="#FFFFFF"><font color="#333333">温馨提示</font>：<font color="red">备份文件同名将覆盖原有的备份文件！</font></td></tr>
</table>
<table width="600" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#ECF5FF" class=tableBorder >
<%    
if Action="BackupData" then
%>
	

 <tr bgcolor="#ECF5FF" class="a4"> 
            <td   height="150" align="center" rowspan="3"><%=msg%></td>
 </tr>
<%
else
%>
<form method="post" action="admin_Database_sql.asp?action=BackupData">

   <tr bgcolor="#ECF5FF" class="a4"> 
            <td width="725" height="40" align="center"  colspan="3">
			备份文件名称：   <input name="bkDBname" type="text" value="Websen_DataBak_sql" size=40 maxlength="50" >
			<font color="#0066CC">.dat</font>
 		 <input name="submit" type=submit value=" &nbsp;开始备份&nbsp; "   style="cursor: hand;background-color: #cccccc;">
			</td>
    </tr></form>
	<tr><td bgcolor="#999999" colspan="3" height="1"></td></tr>	<tr><td bgcolor="#ffffff" colspan="3" height="2"></td></tr>
	<tr><td bgcolor="#658BD8" height="20" colspan="3"><font  color="#FFFFFF"><b>备份记录↓</b></font></td></tr>
	<tr bgcolor="#ECF5FF"><td height="30" >备份名称</td><td align="center">大小</td><td align="center">备份时间</td></tr>
<%
'显示已有的备份文件--------------------------------
   Set fso1 = YXFSO
   dirpath=server.MapPath("../"&strDBPath&"")
  if fso1.FolderExists(dirpath)then
	FileCount=0
	TotleSize=0
	Set theFolder=fso1.GetFolder(dirpath)
	
	For Each theFile In theFolder.Files
	%>
 <tr height="25" bgcolor="#F7F7F7"><td><%=thefile.name%></td><td align="center"><%=formatnumber((theFile.Size/1024/1024),2)%>MB</td><td align="center"><%=thefile.DateLastModified%>&nbsp;  <a href="admin_Database_sql.asp?actiondo=del&delname=<%=thefile.name%>" onClick="return sureok();">删除</a>&nbsp; 
  </td></tr>
 <%
	next
	fso1.close
    end if
'-------------------------------------------
  end if
  %>
 </table>
 </body>
</html>
<%
conn.close
set conn=nothing
%>