<!--#include file="Config.asp" -->
<div class='menu'>&nbsp;数据操作</div>
<div class="content">
<%  
Mgt("p99") 'Cookies : Permission
select case action
case "Backup" call Backup()
case "Resume" call fResume()
case "bfstart" call bfstart()
case "hfstart" call hfstart()
end select
'------------------------------------------------
sub bfstart()
if request.form("newdata")="" then WtMsg("新数据库名称不能为空!")
Set  fso  =  CreateObject("Scripting.FileSystemObject")  
filesource = server.MapPath(request.form("olddata"))
fileto = server.MapPath(request.form("newdata"))
if fso.fileexists(filesource) then
fso.copyfile filesource,fileto,true
else
WtMsg("找不到你要备份的数据库!")
end if
set fso = nothing
response.write("<script>alert('数据库备份成功!');location.href='?eims=Data&action=Backup';</script>")
end sub
%>
  <%sub Backup()%>
  <table width="100%" border="0" cellspacing="1" cellpAdding="1" align="center">
    <form method="post" action="?eims=Data&action=bfstart">
      <tr>
        <td colspan="2"><div class="title">备份数据库</div></td>
      </tr>
      <tr>
        <td colspan="2"><font color="red">* 备份时请不要操作数据！</font></td>
      </tr>
      <tr>
        <td width="20%" align="right">数据库名称：</td>
        <td><input name="olddata" type="text" id="olddata" value="<%=DBDir%>" size="<% =InputSize %>" class="ccc" readonly></td>
      </tr>
      <tr>
        <td align="right">备份后名称：</td>
        <td><input name="newdata" type="text" id="newdata" size="<% =InputSize %>" value="../data/<%=Date()%>.mdb"  class="ccc" readonly></td>
      </tr>
      <tr>
        <td align="right"></td>
        <td><input type="submit" name="Submit" value="开始备份" /></td>
      </tr>
    </form>
  </table>
  <%end sub%>
  <%
sub hfstart()
Set  fso  =  CreateObject("Scripting.FileSystemObject")  
filesource = server.MapPath(request.form("filename"))
fileto = server.MapPath(request.form("newdb"))
fso.copyfile filesource,fileto,true
set fso = nothing
response.write("<script>alert(""数据库恢复成功!"");location.href=""?eims=Data&action=Resume"";</script>")
end sub
%>
  <%sub fResume()%>
  <table width="100%" border="0" cellspacing="1" cellpAdding="1" align="center">
    <form method="post" action="?eims=Data&action=hfstart">
      <tr>
        <td colspan="2"><div class="title">恢复数据库</div></td>
      </tr>
      <tr>
        <td colspan="2"><font color="red">* 恢复时请不要操作数据！</font></td>
      </tr>
      <tr>
        <td width="20%" align="right">已备份数据：</td>
        <td><select name="filename">
<% 	Set  fso  =  CreateObject("Scripting.FileSystemObject")  
Set  f  =  fso.GetFolder(server.MapPath("../Data"))  
Set  fc  =  f.Files  
For  Each  f1  in  fc
%>
            <option value="../Data/<%= f1.name %>">../data/<%= f1.name %></option>
<%
Next  
set fc=nothing
set f = nothing
set fso=nothing
%>
          </select></td>
      </tr>
      <tr>
        <td align="right">恢复后名称：</td>
        <td><input name="newdb" type="text" id="newdb" value="<%=DBDir%>" size="<% =InputSize %>" class="ccc" readonly></td>
      </tr>
      <tr>
        <td></td>
        <td><input type="submit" name="Submit" value="开始还原" /></td>
      </tr>
    </form>
  </table>
  <%end sub%>
</div>
</body></html>
<%Call CloseConn()%>