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

📄 spacesize.asp

📁 本实例为一个完整的网上购物商城的完整例子程序,里面有所以的源代码.希望对大家学习有用.
💻 ASP
字号:
<%
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=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 Showspecialspaceinfo(method)
dim fso, d, fc, f1, size, showsize, drvpath
set fso=server.createobject("scripting.filesystemobject")
drvpath=server.mappath("../x")
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

Function Drawbar(drvpath)
dim fso, drvpathroot, d, size, totalsize, barsize
set fso=server.createobject("scripting.filesystemobject")
drvpathroot=server.mappath("../")
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

Function Drawspecialbar()
dim fso, drvpathroot, d, fc, f1, size, totalsize, barsize
set fso=server.createobject("scripting.filesystemobject")
drvpathroot=server.mappath("../")
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)*400)
Drawspecialbar=barsize
End Function
%>
<html>
<head>
<title>电子购物程式后台管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css.css" type="text/css">
</head>
<body bgcolor="#FFFFCC" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#FFFFFF" vspace="0" hspace="0">
<tr>
<td height="27" background="images/admin_bg_1.gif">.:: 您可以在这里查看系统空间占用情况</td>
</tr>
</table>
<table border="0" cellspacing="1" cellpadding="2" bgcolor="#000000" width="100%" align="center">
<tr>
<td height="22" bgcolor="#6699CC" colspan="2"> <b>系统空间占用情况:</b> </td>
</tr>
<tr>
<td height="22" bgcolor="#BBD1E8" colspan="2">数据及备份数据占用空间:&nbsp; </td>
</tr>
<tr>
<td height="22" bgcolor="#BBD1E8" colspan="2"><img src="images/bar.gif" width=<%=drawbar("../Database")%> height=10>&nbsp; 
<%showSpaceinfo("../Database")%>
</td>
</tr>
<tr>
<td height="22" bgcolor="#BBD1E8" colspan="2">系统&nbsp; 固定&nbsp; 图片占用空间:</td>
</tr>
<tr>
<td height="22" bgcolor="#BBD1E8" colspan="2"><img src="images/bar.gif" width=<%=drawbar("../images")%> height=10>&nbsp; 
<%showSpaceinfo("../images")%>
</td>
</tr>
<tr>
<td height="22" bgcolor="#BBD1E8" colspan="2">系统&nbsp; 流动&nbsp; 图片占用空间:</td>
</tr>
<tr>
<td height="22" bgcolor="#BBD1E8" colspan="2"><img src="images/bar.gif" width=<%=drawbar("../pic")%> height=10>&nbsp; 
<%showSpaceinfo("../pic")%>
</td>
</tr>
<tr>
<td height="22" bgcolor="#BBD1E8" colspan="2">系统占用空间总量为:</td>
</tr>
<tr>
<td height="22" bgcolor="#BBD1E8" colspan="2"><img src="images/bar.gif" width=400 height=10>&nbsp; 
<%showspecialspaceinfo("All")%>
</td>
</tr>
<tr>
<td height="22" bgcolor="#BBD1E8" colspan="2"> </td>
</tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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