Wrance的图片系统目录直读版1.0
2018-09-06 12:16
复制代码 代码如下:
<%@language=vbscriptcodepage=936%>
<%
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++Wrance的图片系统目录直读版1.0+++++++++++++++++++++++
++++++演示:
++++++此为免费程序,您可以任意修改,欢迎发表建议++++++++++
以下为修改内容
ConstUploadDir=/ecg/upload/news/存放文件的目录
ConstMaxPerPage=30每页显示数量
consttitle=+++__Wrance的图片系统目录直读版_标题
检查组件是否已经安装
FunctionIsObjInstalled(strClassString)
IsObjInstalled=False
Err=0
DimxTestObj
SetxTestObj=Server.CreateObject(strClassString)
If0=ErrThenIsObjInstalled=True
SetxTestObj=Nothing
Err=0
EndFunction
dimstrFileName
dimtotalPut,CurrentPage,TotalPages
dimTruePath,fso,theFolder,theFile,whichfile,thisfile,FileCount,TotleSize
strFileName=?
ifrequest(page)<>then
currentPage=cint(request(page))
else
currentPage=1
endif
TruePath=Server.MapPath(UploadDir)
IfnotIsObjInstalled(Scripting.FileSystemObject)Then
Response.Write<b><fontcolor=red>你的服务器不支持FSO(Scripting.FileSystemObject)!不能使用本功能</font></b>
Else
setfso=CreateObject(Scripting.FileSystemObject)
%>
<html>
<head>
<title><%=title%></title>
<metahttp-equiv=Content-Typecontent=text/html;charset=gb2312>
<styletype=text/css>
<!--
.font{
font-size:12px;
color:#000000;
text-decoration:none;
text-align:center;
vertical-align:middle;
line-height:140%;
}
a:link{
font-size:12px;
color:#000000;
text-decoration:underline;
}
a:hover{
font-size:12px;
color:#999999;
text-decoration:none;
}
a:visited{
font-size:12px;
color:#0088B5;
text-decoration:underline;
}
-->
</style>
</head>
<body>
<divalign=center>
<%=title%><br>
<tablewidth=100%height=100%border=0cellpadding=0cellspacing=0>
<tr>
<tdwidth=100%align=centervalign=top>
<%
iffso.FolderExists(TruePath)then
FileCount=0
TotleSize=0
SettheFolder=fso.GetFolder(TruePath)
ForEachtheFileIntheFolder.Files
FileCount=FileCount+1
TotleSize=TotleSize+theFile.Size
next
totalPut=FileCount
ifcurrentpage<1then
currentpage=1
endif
if(currentpage-1)*MaxPerPage>totalputthen
if(totalPutmodMaxPerPage)=0then
currentpage=totalPut\MaxPerPage
else
currentpage=totalPut\MaxPerPage+1
endif
endif
ifcurrentPage=1then
showContent
showpage2strFileName,totalput,MaxPerPage
response.write<br><divalign=center>本页共显示<b>&FileCount-1&</b>个文件,占用<b>&TotleSize\1024&</b>K</div>
else
if(currentPage-1)*MaxPerPage<totalPutthen
showContent
showpage2strFileName,totalput,MaxPerPage
response.write<br><divalign=center>本页共显示<b>&FileCount-1&</b>个文件,占用<b>&TotleSize\1024&</b>K</div>
else
currentPage=1
showContent
showpage2strFileName,totalput,MaxPerPage
response.write<br><divalign=center>本页共显示<b>&FileCount-1&</b>个文件,占用<b>&TotleSize\1024&</b>K</div>
endif
endif
else
response.write找不到文件夹!可能是配置有误!
endif
endif
subshowContent()
dimc
FileCount=1
TotleSize=0
%>
<tablewidth=100%border=0align=centercellpadding=5cellspacing=5>
<trclass=tdbg>
<%ForEachtheFileIntheFolder.Files
c=c+1
ifFileCount>MaxPerPagethen
exitfor
elseifc>MaxPerPage*(CurrentPage-1)then%>
<imgsrc=<%=(UploadDir&theFile.Name)%>border=0width=120height=150></a></td>
<%ifFileCountmod5=0then%>
</TR>
<tr>
<%endif%>
<%FileCount=FileCount+1
TotleSize=TotleSize+theFile.Size
endif
Next
%></tr>
</table>
<%
endsub
%>
</td>
</tr>
</table>
<%
subshowpage2(sfilename,totalnumber,maxperpage)
dimn,i,strTemp
iftotalnumbermodmaxperpage=0then
n=totalnumber\maxperpage
else
n=totalnumber\maxperpage+1
endif
strTemp=<tablealign=center><formname=showpagesmethod=Postaction=&sfilename&><tr><td>
strTemp=strTemp&共<b>&totalnumber&</b>个文件
ifCurrentPage<2then
strTemp=strTemp&首页上一页
else
strTemp=strTemp&<ahref=&sfilename&page=1>首页</a>
strTemp=strTemp&<ahref=&sfilename&page=&(CurrentPage-1)&>上一页</a>
endif
ifn-currentpage<1then
strTemp=strTemp&下一页尾页
else
strTemp=strTemp&<ahref=&sfilename&page=&(CurrentPage+1)&>下一页</a>
strTemp=strTemp&<ahref=&sfilename&page=&n&>尾页</a>
endif
strTemp=strTemp&页次:<strong><fontcolor=red>&CurrentPage&</font>/&n&</strong>页
strTemp=strTemp&<b>&maxperpage&</b>&个文件/页
strTemp=strTemp&转到:<selectname=pagesize=1onchange=javascript:submit()>
fori=1ton
strTemp=strTemp&<optionvalue=&i&
ifcint(CurrentPage)=cint(i)thenstrTemp=strTemp&selected
strTemp=strTemp&>第&i&页</option>
next
strTemp=strTemp&</select>
strTemp=strTemp&</td></tr></form></table>
strTemp=strTemp&<fontcolor=#0083AE>
strTemp=strTemp&设计制作:nbsp;QQ:74028</font>
response.writestrTemp
endsub
%>
上一篇:ASP开发网页牢记注意事项
文章标题:Wrance的图片系统目录直读版1.0
文章链接:http://soscw.com/index.php/essay/10157.html