<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<body background="images/01.gif">
<table width="497" border="0" cellpadding="0" cellspacing="0" height="205">
        <tr class="font"> 
          
    <td width="514" valign="top"> 
      <table border=0 cellpadding=0 cellspacing=0 width=542 height="100">
        <tbody> 
        <tr background="images/iebg.gif"> 
          <td valign=top width="358">名字 </td>
          <td valign=top width="358">&nbsp;</td>
          <td valign=top width="358">&nbsp;</td>
          <td valign=top width="358">&nbsp;</td>
          <td valign=top width="358">&nbsp;</td>
          <td valign=top width="358">&nbsp;</td>
        </tr>
        <tr> 
          <%
Set rs=Server.CreateObject("ADODB.RecordSet")
'判断classid开始
classid=request("classid")
If classid <> "" then
classid = cint(classid)
if err.number <> 0 then 
err.clear
classid = 1
end if
if classid < 1 then 
classid = 1
end if 
else
classid = 1
End if
'判断classid结束
if Request("classid")<>"" then
sql="Select * from music where picclass=" & classid & " order by id Desc"
else
sql="Select * from music order by id Desc"
end if


rs.open sql,conn,1,1
rs.pagesize=pages  '每页显示数目
num=rs.recordcount
pagenum=rs.pagecount
page=request("page")

if rs.eof and rs.bof then
response.Write("此分类没有图片")
else

'判断页码开始
If page <> "" then
page = cint(page)
if err.number <> 0 then 
err.clear
page = 1
end if
if page < 1 then 
page = 1
end if 

else
page = 1
End if
if page*rs.pagesize > num and not((page-1)*rs.pagesize < num)then 
page=1
end if
'判断页码结束

rs.absolutepage = page 'absolutepage：设置指针指向某页开头
if page<>pagenum then
for i=1 to rs.pagesize
%>
          <td valign=top width=358 height="49"><a href="picshow.asp?id=<%=rs("id")%>" target="_blank"><b><%=rs("picname")%></b></a> 
          </td>
          <td valign=top width=358 height="49"></td>
          <td valign=top width=358 height="49"></td>
          <td valign=top width=358 height="49"></td>
          <td valign=top width=358 height="49"></td>
          <td valign=top width=358 height="49"></td>
        </tr>
        <%
rs.movenext
next
else
for i=1 to num-(page-1)*rs.pagesize
%>
        <tr> 
          <td valign=top width="358"><a href="picshow.asp?id=<%=rs("id")%>" target="_blank"><b><%=rs("picname")%></b></a></td>
          <td valign=top width="358">&nbsp;</td>
          <td valign=top width="358">&nbsp;</td>
          <td valign=top width="358">&nbsp;</td>
          <td valign=top width="358">&nbsp;</td>
          <td valign=top width="358">&nbsp;</td>
        </tr>
        <%
rs.movenext
next
end if
end if
rs.close
Set rs=nothing
%>
        </tbody> 
      </table>
        
        <tr> 
          
    <td valign=top width="514" height="51"> 
      <table border=0 cellpadding=0 cellspacing=0 width=540 bgcolor="#FFFFFF">
              <tbody> 
              <tr> 
                <td width=1>&nbsp; </td>
                <td background=images/old/line-h.gif>
                  <table width="94%" border="0" align="center" cellpadding="0" cellspacing="0" height="19" bgcolor="#FFFFFF">
                    <tr> 
                      <td> 
                        <div align="center" class="font"><font color="#333333">共有 
                          <%=num%> 个图片 | <a href=index2.asp?page=1&classid=<%=request("classid")%>>首页</a> 
                          | 
                          <%if page>1 then%>
                          <a href=index2.asp?page=<%=page-1%>&classid=<%=request("classid")%>> 
                          <%end if%>
                          上一页</a> | 
                          <%if page<pagenum then%>
                          <a href=index2.asp?page=<%=page+1%>&classid=<%=request("classid")%>> 
                          <%end if%>
                          下一页</a> | <a href=index2.asp?page=<%if pagenum=0 then%>1<%else%><%=pagenum%><%end if%>&classid=<%=request("classid")%>>尾页</a> 
                          | 页次：<%=page%>/<%=pagenum%>页 | 共<%=pagenum%>页</font></div>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
              </tbody> 
            </table>
          </td>
          
    <td background=images/old/line-s2.gif width="51" height="51">&nbsp;</td>
        </tr>
       
      </table>
    
</body>
</html>
