%
const MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
typeid=request("typeid")
keyword=request("txtitle")
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
if typeid="0" then
set rs=server.createobject("adodb.recordset")
sql="select * from pic where title like '%"&request("txtitle")&"%' order by newsid desc"
rs.open sql,conn,1,1
else
set rs=server.createobject("adodb.recordset")
sql="select * from pic where title like '%"&request("txtitle")&"%' and typeid="&cstr(typeid)&" order by newsid desc"
rs.open sql,conn,1,1
set rstype=server.createobject("adodb.recordset")
typesql="select * from pictype where typeid="&rs("typeid")&""
rstype.open typesql,conn,1,1
types=rstype("type")
end if
if rs.eof or rs.bof then
response.write ""
end if
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,""
else
if (currentPage-1)*MaxPerPage