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

📄 admin_datamanage.asp

📁 后台管理系统
💻 ASP
字号:
<!--#include file="Inc/Inc.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../file/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE4 {color: #ff0000}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%
ClsPub.Chk_Post()
ClsPub.SysConfig()
Dim Action,BackUpId
Action=ClsPub.SafeRequest(3,"Action",1,0,0)
BackUpId=ClsPub.SafeRequest(3,"BackUpId",1,0,0)
Select Case Action
	Case "DataBackUp"
		Call DataBackUp("filebackup")
	Case "productbackup"
		Call DataBackUp("productbackup")
	Case "BackUpList"
		Call BackUpLog()
	Case "ViewBackUp"
		Call ViewBackUp(BackUpId)
	Case "DeleteBackUp"
		Call DeleteBackUp(BackUpId)
	Case "DataRestore"
		Call DataRestore()
	Case "ShowWebSpace"
		Call ShowWebSpace()
	Case Else
		Call AddBackUp()
End Select
Sub AddBackUp()
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="TableBorder">
<form method="post" action="Admin_DataManage.asp?Action=DataBackUp" id=form1 name=form1>
		<tr> 
      <th height="22" class="title" colspan=5>添加备份数据</th>	 
    </tr>
	<tr>
	<tr>
	<td height="22" class="TableRow2">&nbsp;备份数据库:
	  <span class="STYLE4">上传文件数据库</span></td>
	</tr>
	<tr>
	<td height="22" class="TableRow2">&nbsp;备份目录:
	 <input type=text size=20 name="BackUpFolder" value="DataBackUp"></td>
	</tr>
	<tr>
	<td height="22" class="TableRow2">&nbsp;备份文件名称:
	<input type=text size=20 name="BackUpDbName" value="<%=Year(Now)&Month(Now)&Day(Now)&Hour(Now)&Minute(Now)&Second(Now)&".MDB"%>"></td>
	</tr>
	<tr>
	<td height="25" class=TableRow2>&nbsp;
	 <input type=submit value="马上备份" id=submit2 name=submit2></td>
    </tr></form>
	<form method="post" action="Admin_DataManage.asp?Action=productbackup" id=form1 name=form1>
		<tr>
	<td height="22" class="TableRow2">&nbsp;备份数据库:
	  <span class="STYLE4">产品信息数据库</span></td>
	</tr>
	<tr>
	<td height="22" class="TableRow2">&nbsp;备份目录:
	 <input type=text size=20 name="BackUpFolder" value="DataBackUp"></td>
	</tr>
	<tr>
	<td height="22" class="TableRow2">&nbsp;备份文件名称:
	<input type=text size=20 name="BackUpDbName" value="<%=Year(Now)&Month(Now)&Day(Now)&Hour(Now)&Minute(Now)&Second(Now)&".MDB"%>"></td>
	</tr>
	<tr>
	<td height="25" class=TableRow2>&nbsp;
	 <input type=submit value="马上备份" id=submit2 name=submit2></td>
    </tr>
</form>
</table>
<%
End Sub
Sub DataBackUp(whichDB)
	Dim DataBasePath,BackUpFolder,BackUpDbName
	Dim Fso
	Set Fso=Server.Createobject("Scripting.FileSystemObject")
	BackUpFolder=ClsPub.SafeRequest(2,"BackUpFolder",1,0,0)
	BackUpDbName=ClsPub.SafeRequest(2,"BackUpDbName",1,0,0)
	select case whichDB
		case "filebackup"
	        DataBasePath=Server.MapPath(DbPath)
		case "productbackup"
	        DataBasePath=Server.MapPath("../database/asofjwiefjowaejfoaweijf.asax")
	end select
	If fso.FileExists(DataBasePath) Then
		If ClsPub.CheckDir(SysPath&BackUpFolder) = True Then
			Fso.Copyfile DataBasePath,Server.MapPath(SysPath&BackUpFolder& "/"& BackUpDbName)
		Else
			ClsPub.MakeFolder SysPath&BackUpFolder
			Fso.Copyfile DataBasePath,Server.MapPath(SysPath&BackUpFolder& "/"& BackUpDbName)
		End If		
	End If
	Set Fso=Nothing
	ClsPub.DB_Execute("Insert Into TW_BackUpLog(BackUpFolder,BackUpDbName,BackUpTime)Values('"&BackUpFolder&"','"&BackUpDbName&"','"&Now()&"')")
	SysMsg="备份数据库完成,<a href='"&SysPath&BackUpFolder& "/"& BackUpDbName&"'><font color=red>点击下载</font></a>。"
	Call ClsPub.ShowMsg("","")
End Sub
Sub BackUpLog()
	Dim Temp	
	Temp=ClsPub.DB_Query("Select * From TW_BackUpLog Order By BackUpTime Desc")
	If Not IsArray(Temp) Then
		SysMsg="暂无备份记录"
		Call ClsPub.ShowMsg("","")
	End If
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="TableBorder">
        <tr> 
      <th height="22" class="title" colspan=4>备份记录</th>	 
    </tr>
<tr align=center height=23>
<td class="TableRow2"Highlight width="20%"><B>备份目录</B></td>
<td class="TableRow2"Highlight width="31%"><B> 备份文件名称</B></td>
<td class="TableRow2"Highlight width="31%"><B>备份时间</B></td>
<td class="TableRow2"Highlight width="15%"><B>操作</B></td>
</tr>
<%
	Dim i,MyItem,BackUpCount,PageSize,Page
	BackUpCount=Ubound(Temp,2)
	PageSize=15
	Page=Request.QueryString("Page")
	If Page="" OR Not IsNumeric(Page) Then
		Page=1
	Else
		Page=Int(Page)
	End If
	For i = 0 To BackUpCount
		MyItem=MyItem+1
		If MyItem>(Page-1)*PageSize And MyItem<=Page*Pagesize Then
%>
<tr>
<td class="TableRow2" align=center><%=Temp(1,i)%></td>
<td class="TableRow2" align=center>
<%=Temp(2,i)%>
</td>
<td class="TableRow2" align=center><%=Temp(3,i)%></td>
<td class="TableRow2" align=center><a href="Admin_DataManage.asp?Action=ViewBackUp&BackUpId=<%=Temp(0,i)%>">还原</a> <a href="Admin_DataManage.asp?Action=DeleteBackUp&BackUpId=<%=Temp(0,i)%>">删除</a></td>
</tr>
<%
		ElseIf MyItem>Page*PageSize Then
			Exit For
		End If
	Next
%>
<tr><td colspan=4 class="TableRow2" align="right">
<%=ClsPub.PageList(Pagesize,BackUpCount+1,Page,"","")%></td></tr>
</table>
<%
End Sub
Sub ViewBackUp(BackUpId)
	Dim Temp
	If BackUpId=0 Then
		SysMsg="参数不足,无法进行操作"
		Call ClsPub.Alert("Back",0)
		Exit Sub
	End If
	Temp=ClsPub.DB_Query("Select BackUpFolder,BackUpDbName From TW_BackUpLog Where BackUpId="&BackUpId)
	
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="display:none;">
        <tr> 
      <td height="22" class="title" colspan=4>备份记录</td>	 
    </tr><tr>
	<th height=25 >
   					&nbsp;&nbsp;<B>恢复论坛数据</B>( 需要FSO支持,FSO相关帮助请看微软网站 )
	  </th>
  				</tr>
				<form method="Post" Action="Admin_DataManage.asp?Action=DataRestore">
  				
  				<tr>
  					<td height=100 class="td">
  						&nbsp;&nbsp;备份数据库路径:<input type=text size=70 name="BackUpFolder" value="<%=Server.MapPath(SysPath&Temp(0,0)&"/"&Temp(1,0))%>">&nbsp;&nbsp;<BR>
  						&nbsp;&nbsp;目标数据库路径:<input type=text size=70 name="DbPath" value="<%=Server.MapPath(DbPath)%>"><BR><BR>
						&nbsp;&nbsp;<input type=submit value="恢复数据"> <br>注意:一般不需修改目录
  						&nbsp;</td>
  				</tr>	
  				</form>
</table>
<%
End Sub
Sub DataRestore()
	Dim BackUpFolder,DataBasePath,Fso
	BackUpFolder=Request.Form("BackUpFolder")
	DataBasePath=Request.Form("DbPath")
	If BackUpFolder="" Then
		SysMsg="请指定原备份的数据库文件名!"
		Call ClsPub.Alert("Back",0)
		Exit Sub	
	End If
	Set Fso=Server.CreateObject("Scripting.FilesyStemObject")
	If Fso.FileExists(BackUpFolder) Then  					
		Fso.CopyFile BackUpFolder,DataBasePath
		SysMsg="成功恢复数据!"
	Else
		SysMsg="找不到指定的备份文件!"	
	End If
	Call ClsPub.Alert("?",0)
End Sub
Sub DeleteBackUp(BackUpId)
	Dim Temp,DataBasePath
	If BackUpId=0 Then
		SysMsg="参数不足够,无法进行操作"
		Call ClsPub.Alert("Back",0)
		Exit Sub
	End If
	Temp=ClsPub.DB_Query("Select BackUpFolder,BackUpDbName From TW_BackUpLog Where BackUpId="&BackUpId)
	delDBpath="../"&Temp(0,0)&"/"&Temp(1,0)
	DataBasePath=server.Mappath(delDBpath)
	If ClsAdmin.IsExistsFile(DataBasePath) Then
		ClsPub.DB_Execute("Delete * From TW_BackUpLog Where BackUpId="&BackUpId)
		ClsAdmin.DelFile(DataBasePath)
	Else
		ClsPub.DB_Execute("Delete * From TW_BackUpLog Where BackUpId="&BackUpId)
		End If
	SysMsg="备份文件删除成功"
	Call ClsPub.Alert("Admin_DataManage.asp?Action=BackUpList",0)
End Sub
Sub ShowWebSpace()
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="TableBorder">
		<tr> 
      <th height="22" class="title">系统空间占用情况</th>	 
    </tr>
	<tr>
	<td height="69" class="TableRow2">
	系统占用:&nbsp;<img src="../images/bar1.gif" width="<%=Drawbar("../../")%>" height=10><img src="../images/bar1_1.gif" height=10>&nbsp; <%=showSpaceinfo("../../")%> <br><br>
后台文件占用空间总计:&nbsp;<img src="../images/bar3.gif" width="<%=Drawbar("../../ast")%>" height=10><img src="../images/bar3_1.gif" height=10>&nbsp; <%=showSpaceinfo("../../ast")%> <br><br>
前台文件占用空间总计:&nbsp;<img src="../images/bar4.gif" width="<%=Drawspecialbar()%>" height=10><img src="../images/bar4_1.gif" height=10>&nbsp; 827&nbsp;KB <br><br>
数据库文件占用空间总计:&nbsp;<img src="../images/bar2.gif" width="<%=Drawbar("../DataBase")%>" height=10><img src="../images/bar2_1.gif" height=10>&nbsp; <%=showSpaceinfo("../DataBase")%> <br><br>
备份文件占用空间总计:&nbsp;<img src="../images/bar1.gif" width="<%=Drawbar("../DataBackUp")%>" height=10><img src="../images/bar1_1.gif" height=10>&nbsp; <%=showSpaceinfo("../DataBackUp")%> <br><br>
下载文件目录占用空间总计:&nbsp;<img src="../images/bar2.gif" width="<%=Drawbar("../"&ClsPub.TW_Config(23))%>" height=10><img src="../images/bar2_1.gif" height=10>&nbsp; <%=showSpaceinfo("../"&ClsPub.TW_Config(23))%> <br><br>
产品文件目录占用空间总计:&nbsp;<img src="../images/bar2.gif" width="<%=Drawbar("../../up_pic")%>" height=10><img src="../images/bar2_1.gif" height=10>&nbsp; <%=showSpaceinfo("../../up_pic")%> <br><br>
</td>
	</tr>
</table>
<%
End Sub

	Function ShowSpaceInfo(drvpath)
 		dim fso,d,size,showsize
 		set fso=server.createobject("Scripting.FileSystemObject")
 		drvpath=server.mappath(drvpath)
 		set d=fso.getfolder(drvpath)
 		size=d.size
 		showsize=size & "&nbsp;Byte"

 		Set fso=Nothing
 		
 		if size>1024 then
 		   size=(Size/1024)
 		   showsize=formatnumber(size,2) & "&nbsp;KB"
 		end if
 		if size>1024 then
 		   size=(size/1024)
 		   showsize=formatnumber(size,2) & "&nbsp;MB"
 		end if
 		if size>1024 then
 		   size=(size/1024)
 		   showsize=formatnumber(size,2) & "&nbsp;GB"
 		end if

 		ShowSpaceInfo = "<font face=verdana>" & showsize & "</font>"
 	End Function	
 	
 	Function Showspecialspaceinfo(method)
 		dim fso,d,fc,f1,size,showsize,drvpath 
 				
 		set fso=server.createobject("scriptin" & "g.f" & "ilesystemobject")

 		drvpath=server.mappath("./")
 		drvpath=left(drvpath,(instrrev(drvpath,"\")-1))

 		set d=fso.getfolder(drvpath)
 		
 		if method="All" then
 			size=d.size
 		elseif method="Program" then
 			drvpath=server.MapPath("../editor/UploadFile")
 			'Response.Write drvpath
 			set d=fso.getfolder(drvpath)
 			size=d.size
 		end if

		Set fso=Nothing
 		
 		showsize=size & "&nbsp;Byte"
 		if size>1024 then
 		   size=(Size/1024)
 		   showsize=formatnumber(size,2) & "&nbsp;KB"
 		end if
 		if size>1024 then
 		   size=(size/1024)
 		   showsize=formatnumber(size,2) & "&nbsp;MB"
 		end if
 		if size>1024 then
 		   size=(size/1024)
 		   showsize=formatnumber(size,2) & "&nbsp;GB"
 		end if 
 		Showspecialspaceinfo = "<font face=verdana>" & showsize & "</font>"
 	end Function
 	
 	Function Drawbar(drvpath)
 		dim fso,drvpathroot,d,size,totalsize,barsize
 		set fso=server.createobject("scripting.filesystemobject")
 		drvpathroot=server.mappath("../")
 		
 		set d=fso.getfolder(drvpathroot)
 		totalsize=d.size
 		
 		drvpath=server.mappath(drvpath)
 		set d=fso.getfolder(drvpath)
 		size=d.size
 		'Response.Write "["&size&"]"
 
 		barsize=cint((size/totalsize)*100)
 		Drawbar=barsize
 		
 		Set fso=Nothing
 	End Function 
 	
 	Function Drawspecialbar()
 		dim fso,drvpathroot,d,fc,f1,size,totalsize,barsize
 		set fso=server.createobject("scripting.filesystemobject")
 		drvpathroot=server.mappath("../")
 		drvpathroot=left(drvpathroot,(instrrev(drvpathroot,"\")-1))
 		set d=fso.getfolder(drvpathroot)
 		totalsize=d.size
 		
 		set fc=d.files
 		for each f1 in fc
 			size=size+f1.size
 		next
 		
 		barsize=cint((size/totalsize)*100)
 		Drawspecialbar=barsize
 		Set fso=Nothing
 	End Function 

%>
</body>
</html>
<%CloseAll%>
</body>
</html>

⌨️ 快捷键说明

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