⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 database.asp

📁 SMS是SP服务中一种流行的服务类型,用户可以通过发送短信来定制电影,视频,交友,下载等在线服务, 联盟程序正是处于用户与SP商之间的一种接口平台,平台下可以发展站长,站长在自己的站上做宣传. 手
💻 ASP
字号:
<!--#include file="check.asp"-->
<%
call ConnectionDatabase
%>
<html>
<style type="text/css">
<!--
.style4 {font-weight: bold}
-->
</style>
<head>
<title>数据库管理</title>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<body>

<table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" class="tablegg">
  <tr>
    <td><table width="100%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#F1F1F1">
        <tr bgcolor="#E3E2C3">
          <td height="23" bgcolor="#E3E2C3"><div align="center" class="style4"><strong> 数据库管理 </strong></div></td>
        </tr>
        <tr>
          <td valign="top">
<%
select case lcase(request("Action"))
case "backup"
call backup()
case "restore"
call Restore()
case "compact"
call compact()
case "spacesize"
call spaceSize()
case "compactdata"
call CompactData(server.MapPath(db),false)
case "backupdata"
call BackupData()
case "restoredata"
call RestoreData()
end select

Sub ShowSpaceInfo(drvpath)
dim showsize,fso,d,size
set fso=createobject("scripting.filesystemobject") 		
drvpath=server.mappath(drvpath) 
set d=fso.getfolder(drvpath) 		
size=d.size
showsize=size & "&nbsp;Byte" 
if size>1024 then
size=(Size/1024)
showsize=formatnumber(size,2) & "&nbsp;KB"
end if
if size>1024 then
size=(size/1024)
showsize=formatnumber(size,2) & "&nbsp;MB"		
end if
if size>1024 then
size=(size/1024)
showsize=formatnumber(size,2) & "&nbsp;GB"	   
end if   
response.write "<font face=verdana>" &  showsize & "</font>"
End Sub	

Function Drawspecialbar()
dim fso,drvpathroot,d,fc,f1,size,totalsize,barsize
set fso=server.createobject("scripting.filesystemobject")
drvpathroot=server.mappath("../pic")
drvpathroot=left(drvpathroot,(instrrev(drvpathroot,"\")-1))
set d=fso.getfolder(drvpathroot)
totalsize=d.size		
set fc=d.files
for each f1 in fc
size=size+f1.size
next			
barsize=cint((size/totalsize)*500)
Drawspecialbar=barsize
End Function 

Function Drawbar(drvpath)
dim fso,drvpathroot,d,size,totalsize,barsize
set fso=server.createobject("scripting.filesystemobject")
drvpathroot=server.mappath("../pic")
drvpathroot=left(drvpathroot,(instrrev(drvpathroot,"\")-1))
set d=fso.getfolder(drvpathroot)
totalsize=d.size
drvpath=server.mappath(drvpath) 		
set d=fso.getfolder(drvpath)
size=d.size
barsize=cint((size/totalsize)*400)
Drawbar=barsize
End Function 	

Sub Showspecialspaceinfo(method)
dim fso,d,fc,f1,size,showsize,drvpath 		
set fso=server.createobject("scripting.filesystemobject")
drvpath=server.mappath("../pic")
drvpath=left(drvpath,(instrrev(drvpath,"\")-1))
set d=fso.getfolder(drvpath) 		
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 & "&nbsp;Byte" 
if size>1024 then
size=(Size/1024)
showsize=size & "&nbsp;KB"
end if
if size>1024 then
size=(size/1024)
showsize=formatnumber(size,2) & "&nbsp;MB"		
end if
if size>1024 then
size=(size/1024)
showsize=formatnumber(size,2) & "&nbsp;GB"	   
end if   
response.write "<font face=verdana>" & showsize & "</font>"
end sub 	 

sub RestoreData()
if request("backpath")<>"" then backpath=request("backpath")
dbpath=server.MapPath(db)
backpath=server.MapPath( backpath)
Set Fso=createobject("scripting.filesystemobject")
If  fso.fileexists( backpath) = True Then
fso.CopyFile   backpath ,dbpath
response.write "<script language='JavaScript'>{window.alert('恢复数据库成功,您恢复的数据库路径为" & replace(backpath,"\","\\")&"');window.location='"&Request.ServerVariables("HTTP_REFERER")&"';}</script>"
else
response.write "<script language='JavaScript'>{window.alert('找不到您所需要恢复的备份数据库。');window.location='"&Request.ServerVariables("HTTP_REFERER")&"';}</script>"
End if
response.End()
end sub

Function CompactData(dbPath, boolIs97)
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(dbPath) Then
fso.CopyFile dbpath,strDBPath & "temp.mdb"
Set Engine = CreateObject("JRO.JetEngine")
If boolIs97 = "True" Then
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb;" _
& "Jet OLEDB:Engine Type=" & JET_3X
Else
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb"
End If
fso.CopyFile  strDBPath & "temp1.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")
fso.DeleteFile(strDBPath & "temp1.mdb")
Set fso = nothing
Set Engine = nothing
response.write "<script language='JavaScript'>{window.alert('你的数据库, " & replace(dbpath,"\","\\") & ", 已经压缩成功!"  &"');window.location='"&Request.ServerVariables("HTTP_REFERER")&"';}</script>"
Else
response.write "<script language='JavaScript'>{window.alert('数据库压缩失败。');window.location='"&Request.ServerVariables("HTTP_REFERER")&"';}</script>"
End If
End Function

sub backupdata()
if request("bkfolder")<>"" then bkfolder=request("bkfolder") else bkfolder="defaultbak" end if
if request("bkdbname")<>"" then bkdbname=request("bkdbname") else bkdbname="default" end if
bkdbname=bkdbname&"#.asp"
dbpath=server.MapPath(db)
bkfolder=server.MapPath(bkfolder)
Set Fso=createobject("scripting.filesystemobject")
if fso.fileexists(dbpath) then
If  fso.folderexists(bkfolder) = True Then
fso.copyfile dbpath,bkfolder& "\"& bkdbname
else
fso.createfolder  bkfolder
fso.copyfile dbpath,bkfolder& "\"& bkdbname
end if
response.write "<script language='JavaScript'>{window.alert('备份数据库成功,您备份的数据库路径为" &replace(bkfolder& "\"& bkdbname,"\","\\") &"');window.location='"&Request.ServerVariables("HTTP_REFERER")&"';}</script>"
Else
response.write "<script language='JavaScript'>{window.alert('找不到您所需要备份的文件。');window.location='"&Request.ServerVariables("HTTP_REFERER")&"';}</script>"
End if
response.End()
end sub
%>
            <%sub backup()%>
            <form method='post' action='Database.asp?action=BackupData'>
              <table width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor="#FFFFFF">
                <tr align="left" bgcolor="#EDEDE1">
                  <td height='26' colspan="3"><span class="forumRow">&nbsp;&nbsp;&nbsp;<strong>&nbsp;&nbsp;: : 备分数据库 : :</strong></span></td>
                </tr>
                <tr>
                  <td height='26' align='right' bgcolor="#F1F1F1">备份目录:</td>
                  <td height="26" bgcolor="#F1F1F1"><input name=bkfolder type=text class="inputbox" id="bkfolder" value=Databackup size=20></td>
                  <td bgcolor="#F1F1F1">相对路径目录,如目录不存在,将自动创建</td>
                </tr>
                <tr>
                  <td width='200' height='26' align='right' bgcolor="#F1F1F1">备份名称:</td>
                  <td height='26' bgcolor="#F1F1F1"><input name=bkDBname type=text class="inputbox" value='<%=FormatDateTime(now(),2)%>' size=20></td>
                  <td height='34' bgcolor="#F1F1F1">不用输入文件名后缀(默认为“.asa”)。如有同名文件,将覆盖</td>
                </tr>
                <tr align='center'>
                  <td height='26' colspan='3' bgcolor="#F1F1F1"><input name='submit' type=submit class="inputbutton" value=' 开始备份 '></td>
                </tr>
              </table>
            </form>
            <%end sub%>
            <%sub Restore()%>
            <form method='post' action='Database.asp?action=RestoreData'>
              <table width='100%' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor="#FFFFFF" class='border'>
                <tr class='title'>
                  <td height='26' align='left' valign='middle' bgcolor="#EDEDE1"><span class="forumRow">&nbsp;&nbsp;&nbsp;<strong>&nbsp;&nbsp;: : 恢复数据库 : :</strong></span></td>
                </tr>
                <tr class='tdbg'>
                  <td height='26' align='center' valign='middle' bgcolor="#F1F1F1">备份数据库路径(相对):
                  <input name=backpath type=text class="inputbox" id='backpath' value='Databackup\2005-3-27#.asp' size=50 maxlength='200'></td>
                </tr>
                <tr class='tdbg'>
                  <td height='26' align='center' valign='middle' bgcolor="#F1F1F1"><input name='submit' type=submit class="inputbutton" value=' 恢复数据 '></td>
                </tr>
              </table>
            </form>
            <%end sub%>
            <%sub compact%>
            <form method='post' action='Database.asp?action=CompactData'>
              <table width='100%' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor="#FFFFFF" class='border'>
                <tr class='title'>
                  <td height='26' align='left' valign='middle' bgcolor="#EDEDE1"><span class="forumRow">&nbsp;&nbsp;&nbsp;<strong>&nbsp;&nbsp;: : 压缩数据库 : :</strong></span></td>
                </tr>
                <tr class='tdbg'>
                  <td height='26' align='center' valign='middle' bgcolor="#F1F1F1">        压缩前,建议先备份数据库,以免发生意外错误。 </td>
                </tr>
                <tr class='tdbg'>
                  <td height='26' align='center' valign='middle' bgcolor="#F1F1F1"><input name='submit' type=submit class="inputbutton" value=' 压缩数据库 '></td>
                </tr>
              </table>
            </form>
            <%end sub%>
            <%sub SpaceSize()%>
            <br>
            <table width='100%' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor="#FFFFFF" class='border'>
              <tr class='title'>
                <td height='26' align='left' valign='middle' bgcolor="#EDEDE1"><span class="forumRow">&nbsp;&nbsp;&nbsp;<strong>&nbsp;&nbsp;: : 系统文件资源占用情况 : :</strong></span></td>
              </tr>
              <tr class='tdbg'>
                <td width='100%' height='26' valign='middle' bgcolor="#F1F1F1">
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;基本系统占用空间:&nbsp;<img src='img/bar.gif' width='<%= Drawbar("../inc") %>'  height=10>&nbsp;<font face=verdana>
          <%call ShowSpaceInfo("../inc")%>
          </font>
                </td>
              </tr>
              <tr class='tdbg'>
                <td height='26' valign='middle' bgcolor="#F1F1F1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;后台管理占用空间:&nbsp;<img src='img/bar.gif' width='<%= Drawbar("../manage") %>' height=10>&nbsp;<font face=verdana>
                <% call ShowSpaceInfo("../manage") %>
                </font> </td>
              </tr>
              <tr class='tdbg'>
                <td height='26' valign='middle' bgcolor="#F1F1F1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;系统图片占用空间:&nbsp;<img src='img/bar.gif' width='<%= Drawbar("../images") %>' height=10><font face=verdana>
                <% call ShowSpaceInfo("../images") %>
                </font></td>
              </tr>
              <tr class='tdbg'>
                <td height='26' valign='middle' bgcolor="#F1F1F1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;上传目录占用空间:<img src='img/bar.gif' width='<%= Drawbar("../ad") %>' height=10><font face=verdana>
                <% call ShowSpaceInfo("../ad") %>
                </font></td>
              </tr>
              <tr class='tdbg'>
                <td height='26' valign='middle' bgcolor="#F1F1F1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;系统占用空间总计:<img src='img/bar.gif' width='500' height=10><font face=verdana>
                <%call  Showspecialspaceinfo("All") %>
                </font></td>
              </tr>
            </table>
          <% end sub %></td>
        </tr>
        <tr align="center" bgcolor="#EDEDE1">
          <td height="35" align="right"><span class="style1">Copyright 2003 - 2005 IFBEST Inc. AllRights Reserved Design By <a href="http://www.258sp.com" target="_blank">258sp商务平台</a></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
        </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
<%
call DBConnEnd
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -