⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filesdatebaseadmin.asp

📁 东旭网络问卷调查系统 v2.4 很好用的大家试试看
💻 ASP
字号:
<!--#include file="../Include/Config.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../Css/Admin.css" type="text/css" />
</head>
<body>
<div class="admin_m">
<script Language="JScript" runat="server">
function CloseDB(){
		try{
		  	Conn.close();
			Conn = null;
		}catch(e){}
	}
</script>
<script language="javascript">
 function checkAll(e){
      for (i=0;i<document.forms[0].length;i++){
       if (document.forms[0][i].tagName=="INPUT"){
        if (document.forms[0][i].type=="checkbox") {document.forms[0][i].checked=!((!e)?(!window.cAll)?true:false:e.checked);document.forms[0][i].click();}
       }
      }
      if (!e) {window.cAll = !window.cAll}
     }
</script>
<%
AccessFile="../Sur#vey2%fDate#/#2%f#_date_Survey_base#.asp"'设置数据库的地址
bak_folder="data_survey_base_bkup"'设置数据库备份的文件夹
up_files="../UploadImg"'上传文件目录
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table" >
  <tr>
    <th height="25" background="Images/beijing.gif" class="STYLE2"><a href="FilesDateBaseAdmin.asp">数据库管理</a> | <a href="FilesDateBaseAdmin.asp?Smenu=Attachments" >上传文件管理</a></td>
  </tr>
  <tr>
    <td style="line-height:25px;">
    <div align="left" style="padding:5px;">
     <%
     if Request.QueryString("Smenu")="Attachments" then
     %>
   <form action="" method="post" style="margin:0px" onSubmit="if (confirm('是否删除选择的文件或文件夹')) {return true} else {return false}">
   <input type="hidden" name="action" value="Attachments"/>
   <input type="hidden" name="whatdo" value="DelFiles"/>
     <%
     dim AttPath,ArrFolder,Arrfile,ArrFolders,Arrfiles,arrUpFolders,arrUpFolder,TempF
     TempF=""
     AttPath=Request.QueryString("AttPath")
     if len(AttPath)<1 then 
       AttPath=up_files
     elseif bc(server.mapPath(AttPath),server.mapPath(up_files)) then
       AttPath=up_files
     end If
     ArrFolders=split(getPathList(AttPath)(0),"*")
     Arrfiles=split(getPathList(AttPath)(1),"*")
     response.write "<div style=""font-weight:bold;font-size:14px;margin:3px;margin-left:0px"">"&AttPath&"</div><div style=""margin:3px;margin-left:0px;"">"
     if AttPath<>up_files then
       arrUpFolders=split(AttPath,"/")
       for i=0 to ubound(arrUpFolders)-1
        arrUpFolder=arrUpFolder&TempF&arrUpFolders(i)
        TempF="/"
       next
     end if
     if len(arrUpFolder)>0 then
      response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=""FilesDateBaseAdmin.asp?Smenu=Attachments&AttPath="&arrUpFolder&"""><img border=""0"" src=""Images/folder_up.gif"" style=""margin:4px 3px -3px 0px""/>返回上级目录</a><br>"
     end if
     for each ArrFolder in ArrFolders
      response.write "<input name=""folders"" type=""checkbox"" value="""&AttPath&"/"&ArrFolder&"""/>&nbsp;<a href=""FilesDateBaseAdmin.asp?Smenu=Attachments&AttPath="&AttPath&"/"&ArrFolder&"""><img border=""0"" src=""Images/folder.gif"" style=""margin:4px 3px -3px 0px""/>"&ArrFolder&"</a><br>"
     next 
     for each Arrfile in Arrfiles
      response.write "<input name=""Files"" type=""checkbox"" value="""&AttPath&"/"&Arrfile&"""/>&nbsp;<a href="""&AttPath&"/"&Arrfile&""" target=""_blank"">"&getFileIcons(getFileInfo(AttPath&"/"&Arrfile)(1))&Arrfile&"</a>&nbsp;&nbsp;"&getFileInfo(AttPath&"/"&Arrfile)(0)&" | "&getFileInfo(AttPath&"/"&Arrfile)(2)&" | "&getFileInfo(AttPath&"/"&Arrfile)(3)&"<br>"
     next 
     response.write "</div>"
     %>
    <div style="color:#f00">如果文件夹内存在文件,那么该文件夹将无法删除!</div>
	  	<div class="SubButton">
	  	 <input type="button" value="全选" class="button" onClick="checkAll()"/> 
         <input type="submit" name="Submit" value="删除所选的文件或文件夹" class="button"/> 
     </div>
     </form>
	  <%else%>
	  <b>数据库路径:</b> <%=Server.MapPath(AccessFile)%><br/>
	  <b>数据库大小:</b> <span id="accessSize"><%=getFileInfo(AccessFile)(0)%></span><br/>
	  <b>数据库操作:</b> <a href="FilesDateBaseAdmin.asp?do=Compact">压缩修复</a> | <a href="FilesDateBaseAdmin.asp?do=Backup">备份</a><br/>
	  <%
	  Dim AccessFSO,AccessEngine,AccessSource
'-------------压缩数据库-----------------
	  if Request.QueryString("do")="Compact" then
    	Set AccessFSO=Server.CreateObject("Scripting.FileSystemObject")
      	IF AccessFSO.FileExists(Server.Mappath(AccessFile)) Then
		  Response.Write "<div style='padding:4px 0px 4px 10px;border: 1px dotted #999;margin:2px;background:#ffffee'>"
		  Response.Write "压缩数据库开始,网站暂停一切用户的前台操作...<br/>"
		  Response.Write "关闭数据库操作...<br/>"
		  call CloseDB
		  Application.Lock
		  FreeApplicationMemory
		  Application(CookieName & "_SiteEnable") = 0
		  Application(CookieName & "_SiteDisbleWhy") = "网站维护中,请稍候几秒后再来...^-^"
	      Application.UnLock
	      Set AccessEngine = CreateObject("JRO.JetEngine")
	      AccessEngine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath(AccessFile), "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath(AccessFile & ".temp")
	      AccessFSO.CopyFile Server.Mappath(AccessFile & ".temp"),Server.Mappath(AccessFile)
	      AccessFSO.DeleteFile(Server.Mappath(AccessFile & ".temp"))
	      Set AccessFSO = Nothing
	      Set AccessEngine = Nothing
		  Application.Lock
		  Application(CookieName & "_SiteEnable") = 1
		  Application(CookieName & "_SiteDisbleWhy") = ""
		  Application.UnLock
		  Response.write "压缩数据库完成...<br/>"
		  Application.Lock
		  Application(CookieName & "_SiteEnable") = 1
		  Application(CookieName & "_SiteDisbleWhy") = ""
		  Application.UnLock
		  Response.Write "网站恢复正常访问..."
		  Response.Write "</div>"
		  Response.write "<script>document.getElementById('accessSize').innerText='"&getFileInfo(AccessFile)(0)&"'</script>"
      	Else
			Response.Write "<span style=""color: #FF0000"">数据库地址错误,请检查数据库地址</span>"
		end if
	  end if
'-------------备份数据库数据库-----------------
	  if Request.QueryString("do")="Backup" then
    	Set AccessFSO=Server.CreateObject("Scripting.FileSystemObject")
      	IF AccessFSO.FileExists(Server.Mappath(AccessFile)) Then
		  Response.Write "<div style='padding:4px 0px 4px 10px;border: 1px dotted #999;margin:2px;background:#ffffee'>"
		  Response.Write "备份数据库开始,网站暂停一切用户的前台操作...<br/>"
		  Response.Write "关闭数据库操作...<br/>"
		  call CloseDB
		  Application.Lock
		  FreeApplicationMemory
		  Application(CookieName & "_SiteEnable") = 0
		  Application(CookieName & "_SiteDisbleWhy") = "网站维护中,请稍候几秒后再来...^-^"
	      Application.UnLock
          CopyFiles Server.Mappath(AccessFile),Server.Mappath(""&bak_folder&"/Backup_" & DateToStr(Now(),"YmdHIS") & "_" & randomStr(8) &".mbk")
		  Application.Lock
		  Application(CookieName & "_SiteEnable") = 1
		  Application(CookieName & "_SiteDisbleWhy") = ""
		  Application.UnLock
		  Response.write "压缩数据库完成...<br/>"
		  Application.Lock
		  Application(CookieName & "_SiteEnable") = 1
		  Application(CookieName & "_SiteDisbleWhy") = ""
		  Application.UnLock
		  Response.Write "网站恢复正常访问..."
		  Response.Write "</div>"
		  Response.write "<script>document.getElementById('accessSize').innerText='"&getFileInfo(AccessFile)(0)&"'</script>"
      	Else
			Response.Write "<span style=""color: #FF0000"">数据库地址错误,请检查数据库地址</span>"
		End if
       Set AccessFSO=Nothing
	  end if
'---------------还原数据库------------
	  if Request.QueryString("do")="Restore" then
	   AccessSource=Request.QueryString("source")
    	Set AccessFSO=Server.CreateObject("Scripting.FileSystemObject")
      	IF AccessFSO.FileExists(Server.Mappath(AccessSource)) Then
		  Response.Write "<div style='padding:4px 0px 4px 10px;border: 1px dotted #999;margin:2px;background:#ffffee'>"
		  Response.Write "还原数据库开始,网站暂停一切用户的前台操作...<br/>"
		  Response.Write "关闭数据库操作...<br/>"
		  call CloseDB
		  Application.Lock
		  FreeApplicationMemory
		  Application(CookieName & "_SiteEnable") = 0
		  Application(CookieName & "_SiteDisbleWhy") = "网站维护中,请稍候几秒后再来...^-^"
	      Application.UnLock
          CopyFiles Server.Mappath(AccessFile),Server.Mappath(AccessFile & ".TEMP")
          if DeleteFiles(Server.Mappath(AccessFile)) then response.write ("原数据库删除成功<br/>")
          response.write CopyFiles(Server.Mappath(AccessSource),Server.Mappath(AccessFile))
          if DeleteFiles(Server.MapPath(AccessSource)) then response.write ("数据库备份删除成功<br/>")
	  	  if DeleteFiles(Server.Mappath(AccessFile & ".TEMP")) then response.write ("Temp备份删除成功<br/>")
		  Application.Lock
		  Application(CookieName & "_SiteEnable") = 1
		  Application(CookieName & "_SiteDisbleWhy") = ""
		  Application.UnLock
		  Response.write "数据库还原完成...<br/>"
		  Application.Lock
		  Application(CookieName & "_SiteEnable") = 1
		  Application(CookieName & "_SiteDisbleWhy") = ""
		  Application.UnLock
		  Response.Write "网站恢复正常访问..."
		  Response.Write "</div>"
		  Response.write "<script>document.getElementById('accessSize').innerText='"&getFileInfo(AccessFile)(0)&"'</script>"
      	Else
			Response.Write "<span style=""color: #FF0000"">数据库地址错误,请检查数据库地址</span>"
		End if
       Set AccessFSO=Nothing
	  end if
'---------------删除备份数据库------------
	  if Request.QueryString("do")="DelFile" then
	   AccessSource=Request.QueryString("source")
	  'Call ShowAlert(AccessSource,"")
	    Set AccessFSO=Server.CreateObject("Scripting.FileSystemObject")
      	IF AccessFSO.FileExists(Server.Mappath(AccessSource)) Then
		  Response.Write "<div style='padding:4px 0px 4px 10px;border: 1px dotted #999;margin:2px;background:#ffffee'>"
          if DeleteFiles(Server.MapPath(AccessSource)) then response.write ("数据库备份删除成功<br/>")
		  Response.Write "</div>"
		Else
		  Response.Write "<span style=""color: #FF0000"">数据库地址错误,请检查数据库地址</span>"
		end if
       Set AccessFSO=Nothing
      end if
	  %>
	  	  <br/><b>数据库备份列表:</b> <br/>
	  <%
	   dim BackUpFiles,BackUpFile
	   BackUpFiles=split(getPathList(bak_folder)(1),"*")
       for each BackUpFile in BackUpFiles
        response.write "<a href=""backup/"&BackUpFile&""" target=""_blank"">"&getFileIcons(getFileInfo("backup/"&BackUpFile)(1))&BackUpFile&"</a>"
        response.write "&nbsp;&nbsp;<a href=""FilesDateBaseAdmin.asp?do=DelFile&source="&bak_folder&"/"&BackUpFile&""" title=""删除备份文件"">删除</a> | <a href=""FilesDateBaseAdmin.asp?do=Restore&source="&bak_folder&"/"&BackUpFile&""" title=""还原数据库"">还原数据库</a>"
        response.write " | "&getFileInfo(""&bak_folder&"/"&BackUpFile)(0)&" | "&getFileInfo(""&bak_folder&"/"&BackUpFile)(2)&"<br/>"
       next
       %>
	 <%end if%>
	 </div> </td>
  </tr></table>
</div>
</body>
</html>
   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -