📄 admin_filemdb.asp
字号:
<%OPTION EXPLICIT%>
<!--#include file="Include/Config.asp"-->
<!--#include file="Include/SQLAdmin.asp"-->
<!--#include file="Include/Conn.asp"-->
<!--#include file="Include/IPLockAdmin.asp"-->
<%dim Admin_Purview:Admin_Purview="3"%>
<html>
<head>
<title>网站数据管理</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<meta http-equiv="Content-Language" Content="zh-CN">
<meta name="Keywords" Content="">
<meta name="Description" Content="">
<link type="text/css" rel="stylesheet" href="Include/Style.css">
</head>
<body leftmargin="10" topmargin="10" bgcolor="#FFFFFF">
<!--#include file="Include/Session.asp"-->
<%
dim GuSystemError,GuSystemCode,GuSystemMessage,GuSystemURL
dim GuComm
GuComm=Trim(Request.QueryString("GuComm"))
if GuComm<>"" then
select case GuComm
case "BF"
call BackupFile()
case "CD"
call CompressData()
case else
call BackupFileCompressData()
end select
end if
Sub BackupFile()
dim BFFPath,BFFolder,BFFileName
dim FSOa
BFFPath=Trim(Request.Form("BFFPath"))
BFFPath=Server.MapPath(BFFPath)
BFFolder=Request.Form("BFFolder")
BFFileName=Request.Form("BFFileName")
Set FSOa=server.createobject("scripting.filesystemobject")
if FSOa.fileexists(BFFPath) then
if FolderFileCheck(BFFolder)=true then
FSOa.copyfile BFFPath,BFFolder&"\"&BFFileName
else
FolderNewCheck BFFolder
FSOa.copyfile BFFPath,BFFolder&"\"&BFFileName
end if
Set FSOa=Nothing
GuSystemCode=00
GuSystemMessage="备份目录["&BFFolder&"\"&BFFileName&"],已备份完成"
GuSystemURL="<a href=""Admin_FileMDB.asp?GuComm=BFCD""><img src=""Images/Admin_Button_OK.gif"" border=""0""></a>"
else
GuSystemError=true
GuSystemCode=3
GuSystemMessage="没有找到指定要备份的文件"
end if
call GuMessage()
End Sub
Function FolderFileCheck(FolderPath)
dim FSOb
FolderPath=Server.MapPath(".")&"\"&FolderPath
Set FSOb=CreateObject("Scripting.FileSystemObject")
if FSOb.FolderExists(FolderPath) then
FolderFileCheck=true
else
FolderFileCheck=false
end if
Set FSOb=Nothing
End Function
Function FolderNewCheck(FolderName)
dim FSOc,FolderNew
Set FSOc=CreateObject("Scripting.FileSystemObject")
Set FolderNew=FSOc.CreateFolder(FolderName)
FolderNewCheck=true
Set FSOc=Nothing
End Function
Sub CompressData()
dim MDBFolder,MDBFileName,MDBPath,MDBPath2,MDBPath3,MDBPathS
dim FSO,Engine
MDBFolder=Trim(Request.form("MDBFolder"))
if Right(MDBFolder,1)<>"/" then
MDBFolder=MDBFolder&"/"
end if
MDBFileName=Trim(Request.form("MDBFileName"))
MDBPath=MDBFolder&MDBFileName
MDBPath2=Server.MapPath(MDBPath)
if instr(MDBPathS,"/") then
MDBPath3 = left(MDBPath2,instrrev(MDBPath2,"\"))
else
MDBPath3 = left(MDBPath2,instrrev(MDBPath2,"\"))
end if
Set FSO=Server.CreateObject("Scripting.FileSystemObject")
if FSO.FileExists(MDBPath2) Then
Set Engine=CreateObject("JRO.JetEngine")
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&MDBPath2,"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&MDBPath3&"_Temp.mdb"
FSO.CopyFile MDBPath3&"_Temp.mdb",MDBPath2
FSO.DeleteFile(MDBPath3&"_Temp.mdb")
Set FSO=Nothing
Set Engine=Nothing
GuSystemCode=00
GuSystemMessage="数据库文件["&MDBPath&"]已压缩完成"
GuSystemURL="<a href=""Admin_FileMDB.asp?GuComm=BFCD""><img src=""Images/Admin_Button_OK.gif"" border=""0""></a>"
else
GuSystemError=true
GuSystemCode=3
GuSystemMessage="没有找到指定要压缩的数据库文件"
end if
call GuMessage()
End sub
Sub BackupFileCompressData()
%>
<table border="0" cellpadding="0" cellspacing="1" width="600" height="10" bgcolor="#CEEFE7">
<form name="Admin_FileMDB_BF" method="post" action="Admin_FileMDB.asp?GuComm=BF">
<tr>
<td width="600" height="30" background="Images/Admin_T_Bg1.gif" align="center" colspan="3"><font class="BlackS12"><b>网 站 文 件 备 份</b></font></td>
</tr>
<tr>
<td width="600" height="10" bgcolor="#FFFFFF" colspan="3"></td>
</tr>
<tr>
<td width="80" height="28" bgcolor="#FFFFFF" align="center"><font class="BlackS12">文件路径</font></td>
<td width="276" height="28" bgcolor="#FFFFFF"> <input type="text" name="BFFPath" value="Include/Access2000.mdb" class="Admin_InputText" style="width:260;background-color:#FFFFFF;"></td>
<td width="240" height="28" bgcolor="#FFFFFF"> <font class="BlackS12">填写需要备份的文件路径及名称</font></td>
</tr>
<tr>
<td width="80" height="28" bgcolor="#FFFFFF" align="center"><font class="BlackS12">备份目录</font></td>
<td width="276" height="28" bgcolor="#FFFFFF"> <input type="text" name="BFFolder" value="DataBAK" class="Admin_InputText" style="width:260;background-color:#FFFFFF;"></td>
<td width="240" height="28" bgcolor="#FFFFFF"> <font class="BlackS12">填写备份文件的存放目录,目录必须存在</font></td>
</tr>
<tr>
<td width="80" height="28" bgcolor="#FFFFFF" align="center"><font class="BlackS12">备份名称</font></td>
<td width="276" height="28" bgcolor="#FFFFFF"> <input type="text" name="BFFileName" value="" class="Admin_InputText" style="width:260;background-color:#FFFFFF;"></td>
<td width="240" height="28" bgcolor="#FFFFFF"> <font class="BlackS12">填写备份文件新名称,如果有重名则覆盖</font></td>
</tr>
<tr>
<td width="80" height="38" bgcolor="#FFFFFF"></td>
<td width="518" height="38" bgcolor="#FFFFFF" colspan="2"> <input type="submit" name="Submit" value="" class="Admin_Button_ok"> <input type="Reset" value="" name="Admin_Button_Reset" class="Admin_Button_Reset"></td>
</tr>
</form>
</table>
<br>
<table border="0" cellpadding="0" cellspacing="1" width="600" height="10" bgcolor="#CEEFE7">
<form name="Admin_FileMDB_CD" method="post" action="Admin_FileMDB.asp?GuComm=CD">
<tr>
<td width="600" height="30" background="Images/Admin_T_Bg1.gif" align="center" colspan="3"><font class="BlackS12"><b>网 站 数 据 压 缩</b></font></td>
</tr>
<tr>
<td width="600" height="10" bgcolor="#FFFFFF" colspan="3"></td>
</tr>
<tr>
<td width="80" height="28" bgcolor="#FFFFFF" align="center"><font class="BlackS12">文件路径</font></td>
<td width="276" height="28" bgcolor="#FFFFFF"> <input type="text" size="40" name="MDBFolder" value="Include/" class="Admin_InputText" style="width:260;background-color:#FFFFFF;"></td>
<td width="240" height="28" bgcolor="#FFFFFF"> <font class="BlackS12">填写需要压缩的数据库路径</font></td>
</tr>
<tr>
<td width="80" height="28" bgcolor="#FFFFFF" align="center"><font class="BlackS12">文件名称</font></td>
<td width="276" height="28" bgcolor="#FFFFFF"> <input type="text" size="40" name="MDBFileName" value="Access2000.mdb" class="Admin_InputText" style="width:260;background-color:#FFFFFF;"></td>
<td width="240" height="28" bgcolor="#FFFFFF"> <font class="BlackS12">填写需要压缩的数据库名称</font></td>
</tr>
<tr>
<td width="80" height="28" bgcolor="#FFFFFF" align="center"><font class="BlackS12">注释说明</font></td>
<td width="518" height="28" bgcolor="#FFFFFF" colspan="2"> <font class="SilverS12">压缩数据库可能导致错误,建议压缩前先备份数据库</font></td>
</tr>
<tr>
<td width="80" height="38" bgcolor="#FFFFFF"></td>
<td width="518" height="38" bgcolor="#FFFFFF" colspan="2"> <input type="submit" name="Submit" value="" class="Admin_Button_OK"> <input type="Reset" value="" name="Admin_Button_Reset" class="Admin_Button_Reset"></td>
</tr>
</form>
</table>
<%end Sub%>
<br><br>
<!--#include file="Include/Message.asp"-->
</body>
</html>
<%CloseDatabase%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -