让我们一起爱米兰
站内搜搜:
移动设备
请扫描二维码
或访问
m.milan100.com
您所在的位置 -> 米兰百分百 -> ASP -> asp实现查看空间使用状况

asp实现查看空间使用状况

点击数:924 发表时间:2010-07-26 18:40:35 作者: 来源链接:
分享到:
分享到微信

<html>
<head>
<title>空间查看</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="admin/css/style.css" rel="stylesheet" type="text/css">
</head>
<BODY>
<!--#include file="admin/session.asp"-->
<table cellpadding=0 cellspacing=0 border=0 width=95% class="tableBorder" align=center>
<tr>
 <td>
  <table cellpadding=3 cellspacing=1 border=1 width=100% style="border-collapse: collapse" bordercolor="#C0C0C0">
   <tr>
     <th  colspan=2 class="tableHeaderText" bgcolor="#E8F1FF">空间使用情况</th> 
   </tr>
   <tr>
          <td width="80%" align="center" valign=top  class="forumRowHighlight" >
            <%  
  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 & "&nbsp;Byte"
   if size>1024 then
      size=(size\1024)
      showsize=size & "&nbsp;KB"
   end if
   if size>1024 then
      size=(size/1024)
      showsize=size & "&nbsp;MB"  
   end if
   if size>1024 then
      size=(size/1024)
      showsize=size & "&nbsp;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("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=size & "&nbsp;MB"  
   end if
   if size>1024 then
      size=(size/1024)
      showsize=size & "&nbsp;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("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)*100)
   Drawbar=barsize
  End Function  
  
  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)*100)
   Drawspecialbar=barsize
  End Function  
 %>
   <table width=90% cellspacing=1 cellpadding=0 ALIGN="CENTER" >
   <tr>
    <td WIDTH="100%">
   <%
    fsorank=1
    if fsorank=1 then
    %> <br> <%Function GetPP
     dim s
     s=Request.ServerVariables("path_translated")
     GetPP=left(s,instrrev(s,"\",len(s)))
    End function
    if sPP="" then sPP=GetPP
    if right(sPP,1)<>"\" then sPP=sPP&"\"
    set fso=server.createobject("scripting.filesystemobject")
    Set f = fso.GetFolder(sPP)
    Set fc = f.SubFolders
    i=1
                        i2=1
    For Each f in fc%> 目录<b><%=f.name%></b>占用空间:&nbsp;<img src="admin/images/bullet<%=i2%>.gif" width=<%=drawbar(""&f.name&"")%> height=10>&nbsp;<%showSpaceinfo(""&f.name&"")%><br><br>
  <%i=i+1
                          if i2<10 then
        i2=i2+1
                          else
                            i2=1
                          end if
      Next%>
    程序文件占用空间:&nbsp;<img src="admin/images/bullet2.gif" width=<%=drawspecialbar%> height=10>&nbsp;<%showSpecialSpaceinfo("Program")%><br>
                </td>
         </tr>
           </table>
            <font color="#FF0066">系统占用空间总计:
            <%showspecialspaceinfo("All")%>
            </font>
            <%
    else
     response.write "<br><li>本功能暂时关闭"
    end if
    %>
       </td>
     </tr>
   </table>
  </td>
 </tr>
</table>
</body>
</html>

0
很 好
0
一 般
0
差 劲
热门新闻
相关文章
上一篇: asp计算页面的服务器端代码执行时间
下一篇: ASP+MsSqlServer 存储过程分页
评论区
匿名

返回首页 | 收藏本页 | 回到顶部
Copyright 2010. 米兰百分百 Powered By Bridge.
京ICP备15050557号