<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% Response.ContentType="text/vnd.wap.wml" %><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<%
Const MaxPerPage=5
dim classid,currentpage,Nclassid,Nclassname,sql
if request("classid")<>"" then
classid=saferequest("classid",1)
else
classid=1
end if
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
set rs = server.createobject("adodb.recordset")
if request("Nclassid")<>"" then
Nclassid=saferequest("Nclassid",1)
rs.open "select class from picclass where classid="&cstr(Nclassid),conn,1,1
if not rs.eof then
Nclassname=rs("class")
end if
rs.close
else
Nclassid=""
Nclassname="全部图片"
end if
rs.open "select class from picclass where classid="&cstr(classid),conn,1,1
if not rs.eof then
classname=rs("class")
end if
rs.close
%><wml>
<head><meta http-equiv='Cache-Control' content='no-cache'/>
</head>
<card id='main' title='<% =classname %>'>
<p><% =Nclassname %>
<br/>~~~~~~~~~~~~<br/>
<%
if Nclassid<>"" then
sql="select id,link,name,hit from pic where Nclassid="+cstr(Nclassid)+" and classid="+cstr(classid)+" order by id desc"
else
sql="select id,link,name,hit from pic where classid="+cstr(classid)+" order by id desc"
end if
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "还没有任何图片!"
else
totalPut=rs.recordcount
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
showpage totalput,MaxPerPage,"langpic.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
showContent
showpage totalput,MaxPerPage,"langpic.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"langpic.asp"
end if
end if
rs.close
end if
sub showContent
dim i
i=0
do while not rs.eof
%><img src='admin/up/small/<%=rs("link")%>' alt=''/><br/><% =(CurrentPage-1)*MaxPerPage+i+1 %>. <a href='down.asp?id=t<%=rs("id")%>'><%=rs("name")%></a><br/>
下载<%=rs("hit") %><br/>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
end sub
%><br/>
<%
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write ""&CurrentPage&"/"&n&"页,"
response.write "共"&totalnumber&"张"
if CurrentPage<2 then
response.write ""
else
response.write "<br/><a href='"&filename&"?page=1&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"'>[首页]</a>"
response.write " <a href='"&filename&"?page="&CurrentPage-1&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"'>[上页]</a>"
end if
if n-currentpage<1 then
response.write ""
else
response.write "<br/><a href='"&filename&"?page="&(CurrentPage+1)&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"'>[下页]</a>"
response.write " <a href='"&filename&"?page="&n&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"'>[尾页]</a>"
end if
end function
%><br/>------------- <br/>
<%
set rsguang=server.createobject("adodb.recordset")
rsguang.open "select id,title from guanggao where classid='t"&Nclassid&"'",conn,1,1
if rsguang.bof and rsguang.eof then
response.write ""
else
response.write "<a href='vguang.asp?id="&rsguang("id")&"'>"&rsguang("title")&"</a>*<br/>"
end if
rsguang.close
%><a href='steppic.asp?classid=<%=classid %>'><%=classname %></a>
<br/><a href='index.asp'>返回首页</a>
<%
set rs=nothing
conn.close
set conn=nothing
%></p>
</card>
</wml>