Copy Code code as follows:
<% @language =vbscript codepage=936%>
<%
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' ++++++wrance's picture system catalog Direct-read version 1.0+++++++++++++++++++++++
' ++++++ Demo: http://www.cnecg.com/pic.asp++++++++++++++++++
' ++++++ This is a free program, you can modify it arbitrarily, welcome to publish the proposal ++++++++++
' ++++++email:cnecg@yahoo.com.cn,qq:74028+++++++++++++++++++
' The following is the modified content
Const uploaddir= "/ecg/upload/news/" ' Directory of stored files
Const maxperpage=30 ' Show quantity per page
Const title= "+++__wrance picture system Catalog Direct Read _" ' title
' Check if the pieces are installed
Function isobjinstalled (strclassstring)
isobjinstalled = False
ERR = 0
Dim Xtestobj
Set xtestobj = Server.CreateObject (strclassstring)
If 0 = Err Then isobjinstalled = True
Set xtestobj = Nothing
ERR = 0
End Function
Dim strFileName
Dim totalput,currentpage,totalpages
Dim truepath,fso,thefolder,thefile,whichfile,thisfile,filecount,totlesize
Strfilename= "?"
If Request ("page") <> "then
Currentpage=cint (Request ("page")
Else
Currentpage=1
End If
Truepath=server.mappath (Uploaddir)
If not isobjinstalled ("Scripting.FileSystemObject") Then
Response.Write "<b><font color=red> your server does not support FSO (Scripting.FileSystemObject)! You cannot use this feature </font></b> "
Else
Set Fso=createobject ("Scripting.FileSystemObject")
%>
<title><%=title%></title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<style type= "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>
<body>
<div align=center>
<%=title%><br>
<table width= "100%" height= "100%" border= "0" cellpadding= "0" cellspacing= "0" >
<tr>
<TD width= "100%" align= "center" valign= "Top" >
<%
If FSO. FolderExists (Truepath) Then
Filecount=0
Totlesize=0
Set Thefolder=fso. GetFolder (Truepath)
For each thefile in Thefolder.files
Filecount=filecount+1
Totlesize=totlesize+thefile.size
Next
Totalput=filecount
If Currentpage<1 Then
Currentpage=1
End If
if (currentpage-1) *maxperpage>totalput Then
if (totalput mod maxperpage) =0 Then
Currentpage= totalput \ Maxperpage
Else
Currentpage= totalput \ Maxperpage + 1
End If
End If
If Currentpage=1 Then
Showcontent
Showpage2 Strfilename,totalput,maxperpage
Response.Write "<br><div align= ' center ' > This page shows a total of <b>" & FileCount-1 & "</b> files, occupy <b > & totlesize\1024 & "</b> k</div>"
Else
if (currentPage-1) *maxperpage<totalput Then
Showcontent
Showpage2 Strfilename,totalput,maxperpage
Response.Write "<br><div align= ' center ' > This page shows a total of <b>" & FileCount-1 & "</b> files, occupy <b > & totlesize\1024 & "</b> k</div>"
Else
Currentpage=1
Showcontent
Showpage2 Strfilename,totalput,maxperpage
Response.Write "<br><div align= ' center ' > This page shows a total of <b>" & FileCount-1 & "</b> files, occupy <b > & totlesize\1024 & "</b> k</div>"
End If
End If
Else
Response.Write "Folder not found!" It could be an incorrect configuration! "
End If
End If
Sub Showcontent ()
Dim c
Filecount=1
Totlesize=0
%>
<table width= "100%" border= "0" align= "center" cellpadding= "5" cellspacing= "5" >
<tr class= "tdbg" >
<% for each thefile in Thefolder.files
C=c+1
If Filecount>maxperpage Then
Exit For
ElseIf c>maxperpage* (CurrentPage-1) then%>
<td><a href= "<%= (Uploaddir & Thefile.name)%>" target= "_blank" >
border=0 width=120 height=150></a></td>
<% if FileCount mod 5 =0 then%>
</TR>
<tr>
<%end if%>
<% filecount=filecount+1
Totlesize=totlesize+thefile.size
End If
Next
%> </tr>
</table>
<%
End Sub
%>
</td>
</tr>
</table>
<%
Sub Showpage2 (Sfilename,totalnumber,maxperpage)
Dim n, I,strtemp
If Totalnumber mod maxperpage=0 then
n= totalnumber \ Maxperpage
Else
n= totalnumber \ Maxperpage+1
End If
strtemp= "<table align= ' center ' ><form name= ' showpages ' method= ' Post ' action= '" & sFileName & "' > <tr><td> "
Strtemp=strtemp & "Total <b>" & totalnumber & "</b> files"
If Currentpage<2 Then
Strtemp=strtemp & "Home Page Up"
Else
Strtemp=strtemp & "<a href= '" & sFileName & "Page=1 ' > Home </a>"
Strtemp=strtemp & "<a href= '" & sFileName & "Page=" & (CurrentPage-1) & "' > Previous </a>"
End If
If N-currentpage<1 Then
Strtemp=strtemp & "Next Page last"
Else
Strtemp=strtemp & "<a href= '" & sFileName & "Page=" & (currentpage+1) & "' > Next page </a>"
Strtemp=strtemp & "<a href= '" & sFileName & "Page=" & N & "' > Last </a>"
End If
Strtemp=strtemp & "page: <strong><font color=red>" & currentpage & "</font>/" & N & "& Lt;/strong> page "
Strtemp=strtemp & "<b>" & Maxperpage & "</b>" & "Files/page"
Strtemp=strtemp & "goto: <select name= ' page ' size= ' 1 ' onchange= ' javascript:submit () ' >"
For i = 1 to n
Strtemp=strtemp & "<option value= '" & I & "'"
If CInt (currentpage) =cint (i) then Strtemp=strtemp & "selected"
Strtemp=strtemp & "> First" & I & "Page </option>"
Next
Strtemp=strtemp & "</select>"
Strtemp=strtemp & "</td></tr></form></table>"
Strtemp=strtemp & "<font color= ' #0083AE ' >"
Strtemp=strtemp & "Copyright cnecg.com all Rights Reserved copyright +++__wrance Picture System Catalog Direct Read Version _ 1.0<br>"
Strtemp=strtemp & "Design: wrance email:cnecg@yahoo.com.cn qq:74028</font>"
Response.Write strtemp
End Sub
%>