sqlCol=" a.id, a.title, a.nei, a.t, a.rt, a.name, a.url, a.email, a.qq, a.pic, a.yd, a.hf, a.jh, a.bl, a.retime, a.istop, a.ip, a.male, a.face, a.comefrom, a.islock, a.icq, a.msn, a.reid, b.name as re_name, b.title as re_title, b.pic as re_pic, b.bl as re_bl, b.nei as re_nei from ly as a left outer join ly as b on a.reid=b.id and a.id<>b.id "
else
sqlCol=" a.id, a.title, a.t, a.name, a.pic, a.yd, a.hf, a.jh, a.bl, a.retime, a.istop, a.islock, b.name as re_name, b.bl as re_bl from ly as a left outer join ly as b on a.reid=b.id and a.id<>b.id "
end if
if theUser.master then
exec="select reid from ly where rt=0 and isprivate=-1 order by reid desc"
rs.open exec,conn,1,1
if rs.eof then
rs.close
exec="select * from ly where id=0"
elseif page<=1 then
ids=rs(0)
rs.movenext
for i=1 to rcperpage-1
if rs.eof then exit for
ids=ids&","&rs(0)
rs.movenext
next
rs.close
exec="select "& sqlCol &" where a.reid in ("& ids &") order by a.reid desc"
else
rs.pagesize=rcPerpage
rs.absolutepage=page
ids=rs(0)
rs.movenext
for i=1 to rcperpage-1
if rs.eof then exit for
ids=ids&","&rs(0)
rs.movenext
next
rs.close
exec="select "& sqlCol &" where a.reid in ("& ids &") order by a.reid desc"
end if
else
exec="select reid from ly where rt=0 and isprivate=1 and bl=1 and name='"& theUser.name &"' order by reid desc"
rs.open exec,conn,1,1
if rs.eof then
rs.close
exec="select * from ly where id=0"
elseif page<=1 then
ids=rs(0)
rs.movenext
for i=1 to rcperpage-1
if rs.eof then exit for
ids=ids&","&rs(0)
rs.movenext
next
rs.close
exec="select "& sqlCol &" where a.reid in ("& ids &") order by a.istop desc, a.reid desc"
else
rs.pagesize=rcPerpage
rs.absolutepage=page
ids=rs(0)
rs.movenext
for i=1 to rcperpage-1
if rs.eof then exit for
ids=ids&","&rs(0)
rs.movenext
next
rs.close
exec="select "& sqlCol &" where a.reid in ("& ids &") order by a.reid desc"