Admin_BackData.asp
Upload User: pengwei803
Upload Date: 2021-02-10
Package Size: 3311k
Code Size: 4k
Development Platform:

HTML/CSS

  1. <!--#include file="Include/Gaobei_setup.asp"-->
  2. <!--#include file="Conn.asp"-->
  3. <!--#include file="include/char.asp" -->
  4. <!--#include file="Include/check.asp"-->
  5. <!--#include FILE="Include/Admin_Function.asp"-->
  6. <% CheckAdmin3 %>
  7. <link href="other/Admin.css" rel="stylesheet" type="text/css">
  8. <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  9.   <tr> 
  10.     <td align="center" valign="top"> <br> <strong><br>
  11.       </strong> <table width="550" border="0" cellspacing="0" cellpadding="0">
  12.         <tr> 
  13.           <td height="25" align="center">备份数据库
  14. <%
  15.     if request("action")="Backup" then
  16.     call backupdata()
  17.     else
  18. %>
  19. </td>
  20.         </tr>
  21.         <tr> 
  22.           <form method="post" action="?action=Backup">
  23.             <td><br> <table width="80%" border="0" align="center" cellpadding="0" cellspacing="2">
  24.                 <tr> 
  25.                   <td height="25"><strong>备份数据文件</strong>[需要FSO权限]</td>
  26.                 </tr>
  27.                 <tr> 
  28.                   <td height="22"> 当前数据库路径:</td>
  29.                 </tr>
  30.                 <tr> 
  31.                   <td height="22"><input type=text size=50 name=DBpath value="<%=db%>"></td>
  32.                 </tr>
  33.                 <tr> 
  34.                   <td height="22"> 备份数据库目录[如目录不存在,程序将自动创建:</td>
  35.                 </tr>
  36.                 <tr> 
  37.                   <td height="22"><input type=text size=50 name=bkfolder value=DBbackup></td>
  38.                 </tr>
  39.                 <tr> 
  40.                   <td height="22">备份数据库名称[如备份目录有该文件,将覆盖,如没有,将自动创建]</td>
  41.                 </tr>
  42.                 <tr> 
  43.                   <td height="22"><input type=text size=30 name=bkDBname value=#GaoBeiSys_DataBack<%=Date()%>.mdb></td>
  44.                 </tr>
  45.                 <tr> 
  46.                   <td height="22"><div align="center"> 
  47.                       <input type=submit value="确定">
  48.                     </div></td>
  49.                 </tr>
  50.                 <tr> 
  51.                   <td height="22"><br> <br>
  52.                     本程序的默认数据库文件为<%=db%><br>
  53.                     您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>
  54.                     注意:所有路径都是相对与程序空间根目录的相对路径</td>
  55.                 </tr>
  56.                 <tr> 
  57.                   <td height="22">&nbsp;</td>
  58.                 </tr>
  59.               </table></td>
  60.           </form>
  61.         </tr>
  62.       </table>
  63. <%end if%>
  64. <% 
  65.     sub backupdata() 
  66.     Dbpath=request.form("Dbpath") 
  67.     Dbpath=server.mappath(Dbpath) 
  68.     bkfolder=request.form("bkfolder") 
  69.     bkdbname=request.form("bkdbname") 
  70.     Set Fso=server.createobject("scripting.filesystemobject") 
  71.     if fso.fileexists(dbpath) then 
  72.     If CheckDir(bkfolder) = True Then 
  73.     fso.copyfile dbpath,bkfolder& ""& bkdbname 
  74.     else 
  75.     MakeNewsDir bkfolder 
  76.     fso.copyfile dbpath,bkfolder& ""& bkdbname 
  77.     end if 
  78.     response.write "备份数据库成功,您备份的数据库路径为<br>" &bkfolder& ""& bkdbname 
  79.     Else 
  80.     response.write "找不到您所需要备份的文件。" 
  81.     End if 
  82.     end sub 
  83.     '------------------检查某一目录是否存在------------------- 
  84.     Function CheckDir(FolderPath) 
  85.     folderpath=Server.MapPath(".")&""&folderpath 
  86.     Set fso1 = CreateObject("Scripting.FileSystemObject") 
  87.     If fso1.FolderExists(FolderPath) then 
  88.     '存在 
  89.     CheckDir = True 
  90.     Else 
  91.     '不存在 
  92.     CheckDir = False 
  93.     End if 
  94.     Set fso1 = nothing 
  95.     End Function 
  96.     '-------------根据指定名称生成目录--------- 
  97.     Function MakeNewsDir(foldername) 
  98.     Set fso1 = CreateObject("Scripting.FileSystemObject") 
  99.     Set f = fso1.CreateFolder(foldername) 
  100.     MakeNewsDir = True 
  101.     Set fso1 = nothing 
  102.     End Function 
  103. %>
  104. </td>
  105.   </tr>
  106. </table>