<%
dim where_dir,rs,rs_dir
where_dir="dir_id="&id
num=conn.execute("select count(post_id) from photo where "&where_dir)(0)
pagenum=(num-1)\NumPerPage+1
if pagenum<1 then pagenum=1
page=Request.QueryString("page")
if page-1<=0 then page=1
if page-pagenum>0 then page=pagenum
num_now=NumPerPage
if page-pagenum=0 then num_now=num-NumPerPage*(pagenum-1)
if num>0 then
'begin
set rs=conn.execute("select * from (select top "&num_now&" * from photo where (post_id <= (select max(post_id) from (select top "&NumPerPage*Page&" post_id from photo where "&where_dir&" order by post_id) as temp)) and "&where_dir&" order by post_id desc) order by post_id")
while not rs.eof
Response.Write("
"&vbcrlf)
for i=1 to 3
alt_text=trim(rs("post_text"))
if len(alt_text)=0 then alt_text=rs("post_title")
alt_text=replace(alt_text,"""","'")
Response.Write("- "&vbcrlf)
Response.Write(""&vbcrlf)
Response.Write("
"&rs("post_title")&"
"&vbcrlf)
Response.Write(" "&vbcrlf)
rs.movenext
if rs.eof then exit for
next
Response.Write("
"&vbcrlf)
wend
set rs=nothing
'end
end if
%>