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

📄 db_compact.asp

📁 完美政府版,正版网站解决方案
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="conn.asp"-->
<!--#include file="ConnUser.asp"-->
<!--#include file="config.asp"-->
<!--#include file="char.inc"-->
<!--#include file="chkuser.asp" -->
<!--#include file="ChkURL.asp"-->
<!--#include file="ChkManage.asp" -->
<%
IF request.cookies(Forcast_SN)("ManageKEY")<>"super" or request.cookies(Forcast_SN)("ManagePurview")<>"99999" then
	Show_Err("对不起,您的后台管理权限不够!")
	response.end
else
	response.buffer=true
	Response.Expires=0
	
	Set rs9 = Server.CreateObject("ADODB.Recordset")
	sql9 ="SELECT * From "& db_System_Table &" Order By id DESC"
	RS9.open sql9,Conn,1,1
	if rs9("system")="1" or request.cookies(Forcast_SN)("purview")="99999" then
		'这里一定要先关闭数据库,并且保证在压缩时没有使用数据库内容
		rs9.close
		set rs9=nothing
		conn.close
		set conn=nothing

		'**************************************************
		'函数名:IsObjInstalled
		'作  用:检查组件是否已经安装
		'参  数:strClassString ----组件名
		'返回值:True  ----已经安装
		'       False ----没有安装
		'**************************************************
		dim ObjInstalled
		ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")
		
		Function IsObjInstalled(strClassString)
			On Error Resume Next
			IsObjInstalled = False
			Err = 0
			Dim xTestObj
			Set xTestObj = Server.CreateObject(strClassString)
			If 0 = Err Then IsObjInstalled = True
			Set xTestObj = Nothing
			Err = 0
		End Function
		ThisNameFile="Db_Compact.asp"   '定义本文件的文件名
		%>
<html><head> 
<title>ACCESS数据库压缩&#23436;&#32654;&#35774;&#35745;&#32593;&#32476;&#31185;&#25216;&#26377;&#38480;&#20844;&#21496;&#32;&#23436;&#32654;&#25919;&#24220;&#32593;&#31449;&#31649;&#29702;&#31995;&#32479;&#32;&#104;&#116;&#116;&#112;&#58;&#47;&#47;&#119;&#119;&#119;&#46;&#119;&#109;&#103;&#111;&#118;&#46;&#99;&#110;</title>
<style type=text/css>
body  { background:#555555; margin:0px; font-family: Verdana, Arial, sans-serif, 宋体; font-size: 9pt; text-decoration: none; color:#555555;
SCROLLBAR-FACE-COLOR: #55919A;
SCROLLBAR-HIGHLIGHT-COLOR: #cccccc;
SCROLLBAR-SHADOW-COLOR: #cccccc;
SCROLLBAR-3DLIGHT-COLOR: #cccccc;
SCROLLBAR-ARROW-COLOR: #555555;
SCROLLBAR-TRACK-COLOR: #555555;
SCROLLBAR-DARKSHADOW-COLOR: #cccccc;}
table  { border:0px; }
td  { font:normal 12px; }
img  { vertical-align:bottom; border:0px; }
a  { font:normal 12px; color:#555555; text-decoration:none; }
a:hover  { color:#ff6600;text-decoration:underline; }
.sec_menu  { border-left:1px solid white; border-right:1px solid white; border-bottom:1px solid white; overflow:hidden; background:#eeeeee; }
.menu_title  { }
.menu_title span  { position:relative; top:2px; left:8px; color:#555555; font-weight:bold; }
.menu_title2  { }
.menu_title2 span  { position:relative; top:2px; left:8px; color:#ff6600; font-weight:bold; }
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href=site.css rel=stylesheet>
</head> 
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--#include file=Admin_Top.asp-->
<table cellpadding="0" cellspacing="0" border="1" width="100%" bgcolor="#FFFFFF" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" id="AutoNumber1">
<tr class="TDtop"> 
	<td height="30" colspan="2" align="center"><strong>数 据 库 管 理</strong></td>
</tr>
<tr > 
	<td height="25" colspan="2" align="center"><font color="#FF0000">使用本功能需要服务器支持FSO(Scripting.FileSystemObject)!</font></td>
</tr>
<tr> 
	<td width="20%" height="30" align="center"><strong>管理导航:</strong></td>
	<td width="80%" height="30" align="center">
		<a href="<%=ThisNameFile%>?Action=BackupData">备份数据库</a>
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=ThisNameFile%>?Action=RestoreData">恢复数据库</a> 
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=ThisNameFile%>?action=CompressData">压缩数据库</a> 
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=ThisNameFile%>?action=SpaceSize">系统空间占用</a>
	</td>
</tr>
</table>
<%
dim action
action=trim(request("action"))

dim dbpath,bkfolder,bkdbname,fso,fso1
select case action
case "CompressData"		'压缩数据
		dim tmprs
		dim allarticle
		dim Maxid
		dim topic,name,dateandtime,body
		call CompressData()

case "BackupData"		'备份数据
		if request("act")="Backup" then
		call updata()
		else		
		call BackupData()
		end if

case "RestoreData"		'恢复数据
	dim backpath
		if request("act")="Restore" then
			Dbpath=request.form("Dbpath")
			backpath=request.form("backpath")
			if dbpath="" then
				response.write "<div align=center><font color=#FF0000>请输入您要恢复成的数据库全名</font> </div>"	
			else
				Dbpath=server.mappath(Dbpath)
			end if
			backpath=server.mappath(backpath)
			
			Set Fso=server.createobject("scripting.filesystemobject")
			if fso.fileexists(dbpath) then  					
				fso.copyfile Dbpath,Backpath
				response.write "<div align=center><font color=#FF0000>成功恢复数据!</font> </div>"
			else
				response.write "<div align=center><font color=#FF0000>备份目录下并无您的备份文件!</font> </div>"	
			end if
		else
			call RestoreData()
		end if	
case "SpaceSize"		'系统空间占用
		call SpaceSize()	
end select
%>
<!--#include file=Admin_Bottom.asp-->
<%'====================系统空间占用=======================
sub SpaceSize()
On error resume next
%>
<table cellpadding="0" cellspacing="0" border="1" width="100%" bgcolor="#FFFFFF" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" id="AutoNumber1">
<tr class="TDtop">
	<td height="25" colspan="2" align="center" > <strong>系统空间占用情况</strong></td>
</tr>
<%
	If ObjInstalled=false Then
		Response.Write "<tr align=center><td height=30 colspan=3> <div align=center><b><font color=red>你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能</font></b> </div></td></tr>"
	else
		l_path=left(Request.ServerVariables("PATH_INFO"),instrrev(Request.ServerVariables("PATH_INFO"),"/"))
%>
<tr>
	<td width="22%" height="25">&nbsp;【数据库】<img src="images/mdb.gif" height=22>:</td>
	<td width="78%" height="25">&nbsp;<%=ShowFileSize(l_path & db)%></td>
</tr>
<%
		cpath=Server.MapPath(l_path)
		set fsoBrowse=CreateObject("Scripting.FileSystemObject")
		Set theFolder=fsoBrowse.GetFolder(cpath)
		Set theFiles=theFolder.files
		Set theSubFolders=theFolder.SubFolders
		for each SubF in theSubFolders%>
<tr>
	<td>&nbsp;【<%=SubF.name%>】:</td>
	<td>&nbsp;<img src="images/Admin_db_bar.gif" width=<%=drawbar(SubF.name)%> height=10><%showSpaceinfo(SubF.name)%></td>
</tr>
		<%next
		set fsoBrowse=nothing
		set theFolder=nothing
		set theSubFolders=nothing
		%>
<tr>
	<td>&nbsp;系统空间总计:</td>
	<td>&nbsp;<img src="images/Admin_db_bar.gif" width=400 height=10>&nbsp;<%showspecialspaceinfo("All")%></td>
</tr> 
<%end if%>
</table>
<%
end sub
%>
<%'====================恢复数据库=========================
sub RestoreData()
If IsSqlDataBase = 1 Then
	SQLUserReadme()
	Exit Sub
End If
%>
<table cellpadding="0" cellspacing="0" border="1" width="100%" bgcolor="#FFFFFF" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" id="AutoNumber1">
<form method="post" action="<%=ThisNameFile%>?action=RestoreData&act=Restore">		
<tr class="TDtop"> 
	<td height=25 colspan="2" align="center" > &nbsp;&nbsp;<B>恢复数据</B> </td>
</tr>
<tr> 
	<td width="200" height="30" align="right">备份数据库路径(相对):</td>
	<td height="30">&nbsp;<input type=text size=40 name=DBpath value="DataBackup/News30000.mdb"></td>
</tr>
<tr align="center"> 
	<td height="30" colspan="2"><font color="#FF0000">填写备份数据库文件名替换“News30000.mdb”,可自行命名(注意路径不能改变),可以参考下面显示的数据库名称</font></td>
</tr>
<tr> 
	<td width="200" height="30" align="right">当前数据库路径(相对):</td>
	<td>&nbsp;<input type=text size=40 name=backpath readonly value="<%=db%>"></td>
</tr>
<tr align="center"> 
	<td height="30" colspan="2">填写您当前使用的数据库路径,如不想覆盖当前文件,可自行命名(注意路径是否正确)</td>
</tr>				
<tr align="center"> 
	<td height=30 colspan="2">
		<input type=submit value=" &nbsp;恢复数据&nbsp;" <%If ObjInstalled=false Then response.Write "disabled"%> style="cursor: hand;background-color: #cccccc;">
	</td>
</tr>
<%
	If ObjInstalled=false Then
		Response.Write "<tr align=center><td height=30 colspan=2> <div align=center><b><font color=red>你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能</font></b> </div></td></tr>"
	end if
%>	
</form>
</table>
<%
end sub

'====================备份数据库=========================
sub BackupData()
If IsSqlDataBase = 1 Then
	SQLUserReadme()
	Exit Sub
End If
%>
<table cellpadding="0" cellspacing="0" border="1" width="100%" bgcolor="#FFFFFF" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" id="AutoNumber1">
<form method="post" action="<%=ThisNameFile%>?action=BackupData&act=Backup">
<tr class="TDtop"> 
	<td height=25  align="center"> <strong>备份数据库</strong></td>
</tr>
<tr> 
	<td height=100 >
&nbsp;&nbsp;当前数据库路径(相对路径):<input type=text size=40 readonly name=DBpath value="<%=db%>">
&nbsp;相对路径<BR>
&nbsp;&nbsp;备份数据库目录(相对路径):<input type=text size=40 name=bkfolder value="Databackup"> &nbsp;如目录不存在,程序将自动创建<BR>
&nbsp;&nbsp;备份数据库名称(填写名称):<input type=text size=40 name=bkDBname value=<%=date%>.mdb> &nbsp;如备份目录有该文件,将覆盖,如没有,将自动创建
	</td>
</tr>
<tr align="center"> 
	<td height="30" > 
		<input type=submit value=" &nbsp;开始备份&nbsp;" <%If ObjInstalled=false Then response.Write "disabled"%> style="cursor: hand;background-color: #cccccc;">
	</td>
</tr>
<%
	If ObjInstalled=false Then
		Response.Write "<tr align=center><td height=30 > <div align=center><b><font color=red>你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能</font></b> </div></td></tr>"
	end if

⌨️ 快捷键说明

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