admin_database.asp
来自「这是一套基于WEB的网站管理系统」· ASP 代码 · 共 428 行 · 第 1/2 页
ASP
428 行
<!--#include file="setup.asp"-->
<!--#include file="check.asp"-->
<%
Admin_header
'Response.Write "<body oncontextmenu=""return false"" ondragstart=""return false"" onselectstart=""return false"">"
'=====================================================================
' 软件名称:新云网站管理系统
' 当前版本:NewCloud Site Management System Version 2.0.0
' 文件名称:admin_database.asp
' 更新日期:2004-11-20
' 官方网站:新云网络(www.newasp.net) QQ:94022511
'=====================================================================
' Copyright 2002-2005 newasp.net - All Rights Reserved.
' newasp is a trademark of newasp.net
'=====================================================================
Dim bkfolder, bkdbname, fso, fso1
Dim Action
Action = LCase(Request("action"))
Select Case Action
Case "renamedata" '数据库更名
If Not ChkAdmin("RenameData") Then
Server.Transfer("showerr.asp")
Request.End
End If
Call RenameData()
Case "backupdata" '备份数据
If Not ChkAdmin("BackupData") Then
Server.Transfer("showerr.asp")
Request.End
End If
If request("act") = "Backup" Then
If IsSqlDataBase = 1 Then
Call BackupSqlDatabase()
Else
Call BackupDatabase()
End If
Else
Call BackupData()
End If
Case "compressdata" '压缩数据
If Not ChkAdmin("CompressData") Then
Server.Transfer("showerr.asp")
Request.End
End If
If request("act") = "Compress" Then
Call CompressDatabase()
Else
Call CompressData()
End If
Case "restoredata" '恢复数据
If Not ChkAdmin("RestoreData") Then
Server.Transfer("showerr.asp")
Request.End
End If
If request("act") = "Restore" Then
If IsSqlDataBase = 1 Then
Call RestoreSqlDatabase()
Else
Call RestoreDatabase
End If
Application.Contents.RemoveAll
Else
Call RestoreData()
End If
Case "spacesize" '系统空间占用
If Not ChkAdmin("SpaceSize") Then
Server.Transfer("showerr.asp")
Request.End
End If
Call SpaceSize()
Case Else
Errmsg = ErrMsg + "<BR><li>选取相应的操作。"
ReturnError(ErrMsg)
End Select
If FoundErr = True Then
ReturnError(ErrMsg)
End If
Admin_footer
SaveLogInfo(AdminName)
CloseConn
'====================系统空间占用=======================
Sub SpaceSize()
On Error Resume Next
%>
<table border="0" cellspacing="1" cellpadding="5" height="1" align=center width="95%" class="tableBorder"> <tr>
<th height=25>
系统空间占用情况
</th>
</tr>
<tr>
<td class="TableRow1">
<blockquote>
<br>
法规数据占用空间: <img src="images/bar1.gif" width=<%=drawbar("../Database")%> height=10> <%showSpaceinfo("../database")%><br><br>
备份数据占用空间: <img src="images/bar1.gif" width=<%=drawbar("databackup")%> height=10> <%showSpaceinfo("databackup")%><br><br>
后台管理占用空间: <img src="images/bar1.gif" width=<%=drawbar("./")%> height=10> <%showSpaceinfo("./")%><br><br>
软件频道占用空间: <img src="images/bar1.gif" width=<%=drawbar("../Soft")%> height=10> <%showSpaceinfo("../Soft")%><br><br>
文章频道占用空间: <img src="images/bar1.gif" width=<%=drawbar("../Article")%> height=10> <%showSpaceinfo("../Article")%><br><br>
动画频道占用空间: <img src="images/bar1.gif" width=<%=drawbar("../Flash")%> height=10> <%showSpaceinfo("../Flash")%><br><br>
模板图片占用空间: <img src="images/bar1.gif" width=<%=drawbar("../skin")%> height=10> <%showSpaceinfo("../skin")%><br><br>
图片文件占用空间: <img src="images/bar1.gif" width=<%=drawbar("../images")%> height=10> <%showSpaceinfo("../images")%><br><br>
用户文件占用空间: <img src="images/bar1.gif" width=<%=drawbar("../user")%> height=10> <%showSpaceinfo("../user")%><br><br>
上传文件占用空间: <img src="images/bar1.gif" width=<%=drawbar("../UploadFile")%> height=10> <%showSpaceinfo("../UploadFile")%><br><br>
系统占用空间总计: <img src="images/bar2.gif" width=400 height=10> <%showspecialspaceinfo("All")%>
</blockquote>
</td>
</tr>
</table>
<%
End Sub
'====================数据库更名=========================
Sub RenameData()
Dim AccDataPath,AccDataName,sAccDataPath
AccDataPath = Replace(db,"/","\")
sAccDataPath = Split(AccDataPath, "\")
AccDataName = sAccDataPath(UBound(sAccDataPath))
%>
<table width="95%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
<tr><th colspan=2 height="22"> 数剧库更名 ( 需要FSO支持,FSO相关帮助请看微软网站 )</th></tr>
<td width="30%" class="TableRow1Highlight" height=23> 请输入要更改的数据库名称<BR>操作前最好先备份数据库!</td>
<form action="admin_datarename.asp?action=rename" method="post">
<input type=hidden name="oldDataName" value="<%=db%>">
<td width="70%" class="TableRow1"><input name="newDataName" value="<%=AccDataName%>" size="35">
<input name="b1" type="submit" class=button value="确认更名"></td></form>
</tr>
</table>
<%
End Sub
'====================恢复数据库=========================
Sub RestoreData()
%>
<table border="0" cellspacing="1" cellpadding="5" height="1" align=center width="95%" class="tableBorder" <tr>
<th height=25 >
恢复系统数据 ( 需要FSO支持,FSO相关帮助请看微软网站 )
</th>
</tr>
<form method="post" action="?action=RestoreData&act=Restore">
<tr>
<td height=100 class="TableRow1">
备份数据库路径(相对):<input type=text size=45 name=DBpath value="DataBackup\NewCloud_Backup.MDB"> <BR>
目标数据库路径(相对):<input type=text size=45 name=backpath value="<%=db%>"><BR> 填写您当前使用的数据库路径,如不想覆盖当前文件,可自行命名(注意路径是否正确),然后修改conn.asp文件,如果目标文件名和当前使用数据库名一致的话,不需修改conn.asp文件<BR>
<input type=submit value="恢复数据库" class=Button> <br>
-----------------------------------------------------------------------------------------<br>
在上面填写本程序的数据库路径全名,本程序的默认备份数据库文件为DataBackup\NewCloud_Backup.MDB,请按照您的备份文件自行修改。<br>
您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>
注意:所有路径都是相对与程序空间根目录的相对路径</font>
</td>
</tr>
</form>
</table>
<%
End Sub
'====================备份数据库=========================
Sub BackupData()
%>
<table border="0" cellspacing="1" cellpadding="5" height="1" align=center width="95%" class="tableBorder">
<tr>
<th height=25 >
备份系统数据 ( 需要FSO支持,FSO相关帮助请看微软网站 )
</th>
</tr>
<form method="post" action="?action=BackupData&act=Backup">
<tr>
<td height=100 class="TableRow1">
当前数据库路径(相对路径):<input type=text size=45 name=DBpath size=45 value="<%=db%>"><BR>
备份数据库目录(相对路径):<input type=text size=20 name=bkfolder size=45 value=Databackup> 如目录不存在,程序将自动创建<BR>
备份数据库名称(填写名称):<input type=text size=20 name=bkDBname size=45 value=NewCloud_Backup.MDB> 如备份目录有该文件,将覆盖,如没有,将自动创建<BR>
<input type=submit value="备份数据库" class=Button><br>
-----------------------------------------------------------------------------------------<br>
在上面填写本程序的数据库路径全名,本程序的默认数据库文件为<%=db%>,<B>请一定不能用默认名称命名备份数据库</B><br>
您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>
注意:所有路径都是相对与程序空间管理目录的相对路径 </font>
</td>
</tr>
</form>
</table>
<%
End Sub
Sub BackupDatabase()
Dbpath = request.Form("Dbpath")
If InStr(Dbpath, ":") = 0 Then
Dbpath = Server.MapPath(Dbpath)
Else
Dbpath = Dbpath
End If
bkfolder = request.Form("bkfolder")
bkdbname = request.Form("bkdbname")
Set Fso = server.CreateObject("scripting.filesystemobject")
If fso.FileExists(dbpath) Then
If CheckDir(bkfolder) = True Then
fso.CopyFile dbpath, bkfolder& "\"& bkdbname
Else
MakeNewsDir bkfolder
fso.CopyFile dbpath, bkfolder& "\"& bkdbname
End If
Succeed("备份数据库成功,您备份的数据库路径为" &bkfolder& "\"& bkdbname)
Else
FoundErr = True
ErrMsg = "找不到您所需要备份的文件。"
Exit Sub
End If
End Sub
Sub RestoreDatabase()
Dim backpath,Dbpath
Dbpath = request.Form("Dbpath")
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?