Copy codeThe Code is as follows:
<Html>
<Head>
<Meta http-equiv = "Content-Language" content = "zh-cn">
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> database management </title>
</Head>
<Body>
<Div align = center> Database Management System </div>
<Br>
<Br>
<P align = "center">
<%
Dim ZC_DATABASE_PATH
'Database path
ZC_DATABASE_PATH = "database/data. mdb"
Data_array = Split (ZC_DATABASE_PATH ,"/")
Dim action
Action = trim (request ("action "))
Dim dbpath, bkfolder, bkdbname, fso, fso1
Select Case action
Case ""
Call chushihua ()
Case "CompressData" ': compressing data
Dim tmprs
Dim allarticle
Dim Maxid
Dim topic, username, dateandtime, body
Call CompressData ()
Case "BackupData" 'Back Up data
If request ("act") = "Backup" Then
Call updata ()
Else
Call BackupData ()
End If
Case "RestoreData" 'restore Data
Dim backpath
If request ("act") = "Restore" Then
Dbpath = request. form ("Dbpath ")
Backpath = request. form ("backpath ")
If dbpath = "" Then
Response. write "Please input your database whole Name"
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 "the database is restored successfully! <Br>"
Else
Response. write "the database you need is not found! "
End If
Else
Call RestoreData ()
End If
Case "SpaceSize" 'system space usage
Call SpaceSize ()
Case "deletebackup"
Dim dbname
Dbpath = Request. QueryString ("dbpath ")
Dbname = Request. QueryString ("dbname ")
Dbpath = Server. MapPath (dbpath)
Dbpath = dbpath & "\" & dbname
Set fso = CreateObject ("Scripting. FileSystemObject ")
If fso. FileExists (dbPath) Then
Fso. DeleteFile (DBPath)
Set fso = nothing
Response. write "<br> the database you backed up has been" & dbpath & "deleted! <Br> <a href = "" data_s.asp ""> return... </a>"
Else
Response. write dbpath
Response. write "<br> the input path is incorrect. Please confirm and enter it again! <Br> <a href = "" data_s.asp ""> return... </a>"
End If
Case Else
End Select
%>
</Div>
<%
Response. write "</body>
Sub chushihua ()
%>
<Div align = center>
<Form id = "edit">
<Br/>
<A href = "? Action = CompressData "> [compressing a database] </a>
<Br/> <a href = "? Action = BackupData "> [back up a database] </a>
<Br/> <a href = "? Action = RestoreData "> [restore a database] </a>
<Br/> <a href = "? Action = SpaceSize "> [system space usage] </a>
<Br/>
</Form>
</Div>
<% End sub %>
<%
'================================ System space usage ======================== ========
Sub SpaceSize ()
On Error Resume Next
%>
<Div align = center>
<Div align = center>
View system space
<Br/>
<Form id = "edit">
<Br>
Database: <% showSpaceinfo ("../" & data_array (1) & "") %> <br>
Backup Database: <% showSpaceinfo ("databackup") %> <br>
System Total: <% showSpaceinfo ("/") %>
<Br>
</Form>
</Div>
<Br>
<Br>
<Br>
<A href = "data_s.asp"> return... </a>
</Div>
<%
End Sub
%>
<% Sub ShowSpaceInfo (drvpath)
Dim fso, d, size, showsize
Set fso = server. CreateObject ("scripting. filesystemobject ")
Drvpath = server. mappath (drvpath)
Set d = fso. getfolder (drvpath)
Size = d. size
Showsize = size & "Byte"
If size & gt; 1024 Then
Size = (Size/1024)
Showsize = size & "KB"
End If
If size & gt; 1024 Then
Size = (size/1024)
Showsize = formatnumber (size, 2) & "MB"
End If
If size & gt; 1024 Then
Size = (size/1024)
Showsize = formatnumber (size, 2) & "GB"
End If
Response. write "<font face = verdana>" & showsize & "</font>"
End Sub
%>
<%
Sub RestoreData ()
%>
<Div align = center>
<Div align = center>
<Br/> <...