<%rs.movenext
i=i+1
else
response.write" "
end if
end sub
if request("page")<>"" and isnumeric(request("page")) then
currentpage=int(request("page"))
else
currentpage=0
end if
if request("pid")<>"" and isnumeric(request("pid")) then
pid=int(request("pid"))
else
pid=0
end if
if request("pid2")<>"" and isnumeric(request("pid2")) then
pid2=int(request("pid2"))
else
pid2=0
end if
if request("pid3")<>"" and isnumeric(request("pid3")) then
pid3=int(request("pid3"))
else
pid3=0
end if
max=20
%>
<%set rs=server.createobject("adodb.recordset")
sql="select * from products where id is not null"
if pid>0 then
set crs=conn.execute("select * from products_categories where pid="&pid)
do while not crs.eof
pidstr=pidstr&" or pid="&crs("ID")
crs.movenext
loop
crs.close
set crs=nothing
sql=sql&" and (pid="&pid&pidstr&")"
QUERY_STRING=QUERY_STRING&"&pid="&pid
end if
if request("list")="new" then
sql=sql&" and new=1"
QUERY_STRING=QUERY_STRING&"&list=new"
end if
if request("keyword")<>"" then
sql=sql&" and name like '%"&SafeRequest("keyword",0)&"%'"
QUERY_STRING=QUERY_STRING&"&keyword="&request("keyword")&""
end if
sql=sql&" order by top asc,id desc"
rs.open sql,conn,1,1
record=rs.recordcount
if record mod max=0 then
n=record\max
else
n=record\max+1
end if
if currentpage<1 then currentpage=1
if currentpage>n then currentpage=n
if not rs.eof then rs.move(max*(currentpage-1))
if rs.eof and rs.bof then
response.write"No product!"
else
i=1
do while not rs.eof%>
<%products_mode%>
<%products_mode%>
<%products_mode%>
<%products_mode%>
<%if i>=max then exit do
loop
end if
%>
Total <%=n%>Pages<%=record%>ItemsFirstPage
<%if currentpage>1 then
response.write"PreviousPage "
else
response.write"PreviousPage"
end if
if currentpageNextPage "
else
response.write"NextPage"
end if%>
LastPageGoto