<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<!--#include file="../../admin/checkUser.asp"-->
<body background="../../admin/bg_line.gif">
<table width="746" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
        <tr>
          <td width="745">香车美女分类:</a> 
            <%
	sql="select * from class"
	set rs2=conn.execute(sql)
	if not rs2.bof then
	Do While Not rs2.eof
	  if rs2("id")=id then
	     Response.Write("<font color=red>" & rs2("class_name") & "</font> <img src=images/space.gif width=7 height=18 align=absmiddle> ")
	  else
	     Response.Write("<a href=adminpic.asp?classid=" & rs2("id") & ">" & rs2("class_name") & " ")
 	     Response.Write("</a> <img src=images/space.gif width=7 height=18 align=absmiddle> ")
	  end if
	  i=i+1
	  rs2.MoveNext
	  Loop
	end if
	rs2.close
	%>
          </td>
        </tr>
</table><table width=95% border=0 align="center" cellpadding=0 cellspacing=1>
  <tbody> 
  <tr bgcolor="#E1E7ED"> 
    <td height="25" valign=middle background="images/iebg.gif"> 
      <div align="center"><font size="3" color="#FFFFFF"><b>名字</b></font></div>    </td>
    <td valign=middle background="images/iebg.gif"> 
      <div align="center"><font size="3" color="#FFFFFF"><b>设为推荐</b></font></div>    </td>
    <td valign=middle background="images/iebg.gif"> 
      <div align="center"><font size="3" color="#FFFFFF"><b>修改</b></font></div>    </td>
    <td valign=middle background="images/iebg.gif"> 
      <div align="center"><font size="3" color="#FFFFFF"><b>删除</b></font></div>    </td>
    <td valign=middle background="images/iebg.gif"> 
      <div align="center"><font size="3" color="#FFFFFF"><b>人气</b></font></div>    </td>
    <td valign=middle background="images/iebg.gif"> 
      <div align="center"><font size="3" color="#FFFFFF"><b>添加时间</b></font></div>    </td>
    <td valign=middle background="images/iebg.gif"><strong><font color="#FFFFFF"> 　类别</font></strong></td>
  </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 pic where picclass=" & classid & " order by id Desc"
else
sql="Select * from pic order by id Desc"
end if


rs.open sql,conn,1,1
rs.pagesize=20  '每页显示数目
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
%>
    <tr align="center" valign="middle" bgcolor="#E1E7ED"><td height="25"><a href="picshow.asp?id=<%=rs("id")%>" target="_blank"><b><%=rs("picname")%></b></a></td>
    <td><div align="center"><a href="isgood.asp?id=<%=rs("id")%>">推荐</a></div></td>
    <td><div align="center"><a href="edit.asp?id=<%=rs("id")%>">修改</a></div>    </td>
    <td> <a href="del.asp?id=<%=rs("id")%>">删除</a></td>
    <td><b><%=rs("pichits")%></b></td>
    <td>[<%=rs("pictime")%>]</td>
    <td><%sql="select id,class_name from class where id="&rs("picclass")
		  set rs1=conn.execute(sql)%><%=rs1("class_name")%>
      <%rs1.close
		  set rs1=nothing%></td>
  </tr>
  <%
rs.movenext
next
else
for i=1 to num-(page-1)*rs.pagesize
%>
  <tr align="center" valign="middle"  bgcolor="#E1E7ED"> 
    <td height="25"><a href="picshow.asp?id=<%=rs("id")%>" target="_blank"><b><%=rs("picname")%></b></a></td>
    <td> 
      <div align="center"><a href="isgood.asp?id=<%=rs("id")%>">推荐</a></div></td>
    <td> 
      <div align="center"><a href="edit.asp?id=<%=rs("id")%>">修改</a></div></td>
    <td> <a href="del.asp?id=<%=rs("id")%>">删除</a></td>
    <td><b><%=rs("pichits")%></b></td>
    <td>[<a href="del.asp?id=<%=rs("id")%>"></a><%=rs("pictime")%>]</td>
    <td><%sql="select id,class_name from class where id="&rs("picclass")
		  set rs1=conn.execute(sql)%><%=rs1("class_name")%> 
      <%rs1.close
		  set rs1=nothing%></td>
  </tr>
  <%
rs.movenext
next
end if
end if
rs.close
Set rs=nothing
%>
  <tr bgcolor="#E1E7ED"> 
    <td colspan="7" valign=top> 
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" height="19">
        <tr> 
          <td height="40"> 
            <div align="center"><font color="#333333">共有 <%=num%> 
              个图片 | <a href=adminpic.asp?page=1&classid=<%=request("classid")%>>首页</a> 
              | 
              <%if page>1 then%>
              <a href=adminpic.asp?page=<%=page-1%>&classid=<%=request("classid")%>> 
              <%end if%>
              上一页</a> | 
              <%if page<pagenum then%>
              <a href=adminpic.asp?page=<%=page+1%>&classid=<%=request("classid")%>> 
              <%end if%>
              下一页</a> | <a href=adminpic.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>