📄 admin_database.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../conn/conn.asp" -->
<!--#include file="../../inc/Commoncode.asp"-->
<!--#include file="../checkvalid.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href=../css/style.css rel=stylesheet type="text/css">
</head>
<body>
<%If ChkPost=True then
Select Case Request("Action")
Case "compress"
If Not FRAdminLevel(503) Then
Call ErrorMsg()
End If
If FR_HR_DataBaseType=1 then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>该版本数据库类型不支持在线压缩!</li>"
Else
Compress()
End If
Case "BackUp"
If Not FRAdminLevel(501) Then
Call ErrorMsg()
End If
BackUp()
Case "resume"
If Not FRAdminLevel(502) Then
Call ErrorMsg()
End If
wResume()
Case "ExecSql"
If Not FRAdminLevel(504) Then
Call ErrorMsg()
End If
Db_ExecSQL()
Case "Space"
If Not FRAdminLevel(505) Then
Call ErrorMsg()
End If
GetSpaceInfo()
Case "CompressData":CompressData()
Case "BackUpData":BackUpData()
Case "wResumeData":wResumeData()
End Select
if FoundErr=True then
call Show_Err()
end if
Else
Response.Write("<SCRIPT language=JavaScript>alert('禁止非法提交数据!');window.close();</script>")
response.end()
End If
%>
<%
Sub GetSpaceInfo()
Dim SysPath, FSO, F, FC, I, I2
%>
<table width='100%' border='0' align="center" cellpadding='2' cellspacing='1' class="tableBorder" oncontextmenu=""return false"">
<tr>
<th height='25'>系统空间使用情况</th>
</tr>
</table>
<table width='100%' border='0' align="center" cellpadding='2' cellspacing='1' class="tableBorder" oncontextmenu=""return false"">
<tr>
<td valign='top'>
<br><table width=90% border=0 align='center' cellpadding=2 cellspacing=1 bgcolor='#C4D8ED'>
<%
SysPath = Server.MapPath("\") & "\"
Set FSO = Server.CreateObject(FR_HR_fso)
Set F = FSO.GetFolder(SysPath)
Set FC = F.SubFolders
I = 1
I2 = 1
For Each F In FC
%>
<tr>
<td height=25 bgcolor='#EEF8FE'><img src='../Images/folderclosed.gif' width='20' height='20' align='absmiddle'><b><%=F.name%></b> 占用空间: <img src='../Images/bar2.gif' width="<%=Drawbar(F.name)%>" height=10>
<%ShowSpaceInfo (F.name)%>
</td>
</tr>
<%
I = I + 1
If I2 < 10 Then
I2 = I2 + 1
Else
I2 = 1
End If
Next
%>
<tr>
<td height='25' bgcolor='#EEF8FE'> 程序文件占用空间: <img src='../Images/bar2.gif' width="<%=Drawspecialbar%>" height=10>
<%Showspecialspaceinfo ("Program")%>
</td>
</tr>
</table>
<table width=90% border=0 align='center' cellpadding=3 cellspacing=1 bgcolor="#C4D8ED">
<tr>
<td height='28' align='right' bgcolor='#FFFFFF'><font color='#FF0066'><strong><font color='#006666'>系统占用空间总计:</font></strong>
<%Showspecialspaceinfo ("All")%>
</font> </td>
</tr>
</table></td>
</tr>
</table>
<% End Sub
Sub ShowSpaceInfo(drvpath)
Dim FSO, d, size, showsize
Set FSO = Server.CreateObject(FR_HR_fso)
Set d = FSO.GetFolder(Server.MapPath("/" & drvpath))
size = d.size
showsize = size & " Byte"
If size > 1024 Then
size = (size \ 1024)
showsize = size & " KB"
End If
If size > 1024 Then
size = (size / 1024)
showsize = size & " MB"
End If
If size > 1024 Then
size = (size / 1024)
showsize = size & " GB"
End If
Response.Write "<font face=verdana>" & showsize & "</font>"
End Sub
Sub Showspecialspaceinfo(method)
Dim FSO, d, FC, f1, size, showsize, drvpath
Set FSO = Server.CreateObject(FR_HR_fso)
Set d = FSO.GetFolder(Server.MapPath("/"))
If method = "All" Then
size = d.size
ElseIf method = "Program" Then
Set FC = d.Files
For Each f1 In FC
size = size + f1.size
Next
End If
showsize = size & " Byte"
If size > 1024 Then
size = (size \ 1024)
showsize = size & " KB"
End If
If size > 1024 Then
size = (size / 1024)
showsize = size & " MB"
End If
If size > 1024 Then
size = (size / 1024)
showsize = size & " GB"
End If
Response.Write "<font face=verdana>" & showsize & "</font>"
End Sub
Function Drawbar(drvpath)
Dim FSO, drvpathroot, d, size, totalsize, barsize
Set FSO = Server.CreateObject(FR_HR_fso)
Set d = FSO.GetFolder(Server.MapPath("/"))
totalsize = d.size
Set d = FSO.GetFolder(Server.MapPath("/" & drvpath))
size = d.size
barsize = CInt((size / totalsize) * 100)
Drawbar = barsize
End Function
Function Drawspecialbar()
Dim FSO, drvpathroot, d, FC, f1, size, totalsize, barsize
Set FSO = Server.CreateObject(FR_HR_fso)
Set d = FSO.GetFolder(Server.MapPath("/"))
totalsize = d.size
Set FC = d.Files
For Each f1 In FC
size = size + f1.size
Next
barsize = CInt((size / totalsize) * 100)
Drawspecialbar = barsize
End Function
%>
<% Sub Compress() %>
<table width="100%" border="0" align=center cellpadding="2" cellspacing="1" class="tableBorder">
<form action="?action=CompressData" method="post">
<tr>
<th height=25 class="tableHeaderText">压缩数据库</th>
</tr>
<tr>
<td height=25 class="amtd"><b>注意:</b> 正在使用中数据库不能压缩,请选择备份数据库进行压缩操作</td>
</tr>
<tr>
<td class="amtd">压缩数据库:
<input type="text" name="dbpath" value="../BackUp/BackUp.Mdb">
<input name="submit" type="submit" value="开始压缩" class="inputs"></td>
</tr>
<tr>
<td class="amtd">
<input type="checkbox" class="checkbox" name="boolIs97" value="True">
如果使用 Access 97 数据库请选择 (默认为 Access 2000 数据库)<br> <br></td>
</tr>
</form>
<form>
</form>
</table>
<% End Sub %>
<% Sub BackUp() %>
<table width="100%" border="0" align=center cellpadding="2" cellspacing="1" class="tableBorder">
<tr>
<th height=25 class="tableHeaderText"> <B>备份数据库</B></th>
</tr>
<form method="post" action="?Action=BackUpData">
<tr>
<td height=25 class="amtd"><%If FR_HR_DataBaseType=1 then%>
备份数据库目录(相对路径):
<input type="text" size=30 name="bkfolder" value="../BackUp" readonly />
请登陆FTP进入备份目录下载并保存备份文件<BR>
备份数据库名称(填写名称):
<input type=text size=30 name="bkDBname" value="sql<%=datenum(now())%>.bak" readonly />
备份文件名称系统自动生成
<BR>
<input name="submit2" type=submit value="备份数据" class="inputs">
<br>
<%else%>
备份数据库目录(相对路径):
<input type="text" size=30 name="bkfolder" value="../BackUp" readonly />
请登陆FTP进入备份目录下载并保存备份文件<BR>
备份数据库名称(填写名称):
<input type=text size=30 name="bkDBname" value="<%=datenum(now())%>.mdb.bak" readonly />
备份文件名称系统自动生成
<BR>
<input name="submit2" type=submit value="备份数据" class="inputs">
<br>
<%end if%>
</td>
</tr>
</form>
</table>
<% End Sub %>
<% Sub wResume() %>
<table width="100%" border="0" align=center cellpadding="2" cellspacing="1" class="tableBorder">
<form method="post" action="?action=wResumeData">
<tr>
<th height=25 class="tableHeaderText">恢复数据库</th>
</tr>
<tr>
<td height=25 class="amtd"> 备份数据库路径(相对):
<input name=DBpath type=text id="DBpath" value="../Backup/Backup.Mdb" size=30 />
<BR>
<input name="submit3" type=submit value="恢复数据" class="inputs">
</td>
</tr>
</form>
</Table>
<% End Sub %>
<%
'在线执行SQL
Sub Db_ExecSQL()
Dim Flag:Flag=Trim(Request.QueryString("Flag"))
IF Flag="Result" Then
Call ExecuteSql
Else
%>
<table width=100% border=0 align=center cellpadding=2 cellspacing=1 class=tableBorder>
<tr>
<th height=25 class=tableHeaderText>在线执行SQL语句</th>
</tr>
</table>
<script language="javascript">
<!--
function CheckForm()
{if (document.ExecuteForm.Sql.value=='')
{
alert('请输入SQL查询语句!');
document.ExecuteForm.Sql.focus();
return false;
}
ExecuteSQLFrame.location.href="Admin_Database.asp?Action=ExecSql&Flag=Result&SQL="+document.ExecuteForm.Sql.value;
return false;
}
-->
</script><table width="100%" height="100%" border=0 align=center cellpadding=2 cellspacing=1 class=tableBorder>
<form name="ExecuteForm" method="post" Action="?Action=ExecSql" onSubmit="return CheckForm()">
<tr>
<td style="height:80px;" valign="top">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -