<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
'****************************************************************
'**   版权所有：烈火工作室  演示网站http://www.strongfire.cn   **
'**   QQ:839225572   邮箱：strongfire2008@163.com              **
'**   非正版用户不得擅自非法修改用于商业用途！查出必究。       **
'****************************************************************
%>
<!--#include file="islogin.asp"-->
<!--#include file="Check_SqlIn.asp"-->
<%
'=====================压缩参数=========================
Function CompactDB(dbPath, boolIs97)
Dim fso, Engine, strDBPath,JET_3X
strDBPath = left(dbPath,instrrev(DBPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(dbPath) Then
Set Engine = CreateObject("JRO.JetEngine")
	If boolIs97 = "True" Then
	
		Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath, _
		"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb;" _
		& "Jet OLEDB:Engine Type=" & JET_3X
	Else	
		Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath,"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb"
	End If
	
fso.CopyFile strDBPath & "temp.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")

Set Engine = nothing

	 CompactDB = "数据库, " & dbpath & ", 已经压缩成功!" & vbCrLf

Else
	CompactDB = "数据库名称或路径不正确. 请重试!" & vbCrLf
End If
Set fso = nothing
End Function

'=====================备份数据库=========================
Function CopyDB(dbPath, bkpath)
	Set fso = CreateObject("Scripting.FileSystemObject")
	If fso.FileExists(dbPath) Then
		fso.CopyFile dbpath,bkpath
		
		CopyDB = "数据库, " & dbpath & ", 已经备份成功!" & vbCrLf
	Else
		CopyDB = "数据库名称或路径不正确. 请重试!" & vbCrLf
	End If
	Set fso = nothing
End Function

'=====================恢复数据库=========================
Function RestoreDB(dbPath, bkpath)
	Set fso = CreateObject("Scripting.FileSystemObject")
	
	If fso.FileExists(bkpath) Then
		fso.CopyFile bkpath,dbpath
		
		
		RestoreDB = "数据库, " & dbpath & ", 已经恢复成功!" & vbCrLf
	Else
		RestoreDB = "数据库名称或路径不正确. 请重试!" & vbCrLf
	End If
	Set fso = nothing
End Function
%>

<html>
<head>
<LINK href="admin_Css.css" type=text/css rel=stylesheet>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改信息列表</title>

<style type="text/css">
<!--
.STYLE1 {
	font-size: 14px;
	color: #0000FF;
	font-weight: bold;
}
.STYLE2 {color: #000000}
-->
</style>
</head>

<%
dbpath = server.mappath("..\data\!%article%!.asp")
bkpath = server.mappath("..\data\bk!%article%!.asp")
act=request("act")
if act="compress" then
	datamsg=(CompactDB(dbpath,0))	
end if
if act="copy" then
	datamsg=CopyDB(dbPath, bkpath)
end if

if act="restore" then
	datamsg=RestoreDB(dbPath, bkpath)
end if

%>
<body>
<div align="center">
  <p><br>
      <span class="STYLE1">数据管理</span></p>
  <table width="350" border=0 align=center cellspacing=1 class="list1">
    
    
    <tr>
      <td height="39" ><div align="center"><a href="datamanage.asp?act=compress" onClick="return confirm('确定要压缩数据库？')" >压缩数据库</a>&nbsp;&nbsp;&nbsp; 
	  
	  <a href="datamanage.asp?act=copy" onClick="return confirm('确定要备份数据库？')" >备份数据库</a> &nbsp;&nbsp;&nbsp;
	  
	  <a href="datamanage.asp?act=restore" onClick="return confirm('确定要恢复数据库？')" >恢复数据库</a></div>
        <div align="center"></div>
      <div align="center"></div>      </td>
    </tr>
    
    <tr>
      <td ><div align="left"><span class="STYLE2">·操作前最好先备份数据库</span><br>
          <font color="#808080"><span class="STYLE2">·</span></font><span class="STYLE2">正在使用中数据库不能压缩<br>
·<span class="tdbg2">目标数据库路径(相对)</span>data\!%article%!.asp<br>
<span class="tdbg2">·备份数据库路径(相对)data\bk!%article%!.asp</span></span></div>
        <div align="center"></div></td>
    </tr>
  </table>
  <p><%response.Write"<div align='center'>"&datamsg&"</div>"%></p>
  <p><br>
  </p>
</div>
</body>

</html>
