<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->

<%

call head()

dim ids,tid,TP,YD_name

tid=request("tid")
ids=request("ids")
if ids="" or Isnumeric(ids)=False then
ids=myid
end if


TP=request("TP")
if TP="" or Isnumeric(TP)=False then TP=1
TP=clng(TP)
if TP=1 then

if ids<>"" and clng(ids)<>myid then

'检查ID是否存在
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "select * from users where id="&ids,conn,1,1
dim nameids
nameids=rs("name")
if rs.eof then
  rs.close
  set rs=Nothing
  Call Error("<card title=""出错""><p>会员ID不存在！")
end if
if myid<>0 then
mz="[url=uinfo.asp?id="&myid&"&amp;saytk="&saytk&"&sid=[sid]]"&myni&"[/url]"
else
mz="游客"
end if
conn.execute("insert into sqdt(shijian,dz)values('"&now&"','"&mz&"看了"&nameids&"的(url=/bbs/alist.asp?ids="&ids&"&amp;sid=[sid])全部帖子(/url)')")
rs.close
  set rs=Nothing

Call saycardc("TA的帖子")

else
ids=myid
Call saycardc("我的帖子")

end if
else

if ids<>"" and clng(ids)<>myid then
if ids="" or Isnumeric(ids)=False then
  Call Error("会员ID无效！")
  end if
Call saycardc("TA的帖子")


else
ids=myid
Call saycardc("我的帖子")
end if

end if
set rs=Server.CreateObject("ADODB.Recordset")

if TP=1 then
rs.open"select * from sell where fid="&ids&" and yc=0 order by  num,retime desc",conn,1,1
else
rs.open"select * from sell where yc=0 and id in (SELECT tid from relist where fid= "&ids&") order by num,retime desc",conn,1,1
end if

If Not rs.eof	Then
	Dim PageSize,i
	PageSize=listnum					
	Dim Count,page,pagecount,gopage			
	gopage="alist.asp?tid="&tid&"&amp;ids="&ids&"&amp;TP="&TP&"&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;"
	Count=rs.recordcount	
	page=int(request.QueryString ("page"))
	if page<=0 or page="" then page=1		
	pagecount=(count+pagesize-1)\pagesize	
        if page>pagecount then page=pagecount
	rs.move(pagesize*(page-1))
	For i=1 To PageSize     						
	If rs.eof Then Exit For	
response.write ""&i+(page-1)*PageSize&"."
    if rs("num")=1 then response.write("[顶]")
    if rs("num")=20 then response.write("[固]")
    if rs("jj")="1" then response.write("[精]")
    if rs("st")="1" then response.write("[锁]")
    if rs("lx")="2" then response.write("[投]")
    if rs("lx")="4" then response.write("[隐]")
response.write "<a href='topic.asp?tid="&rs("id")&"&amp;ppage="&page&"&amp;saytk="&saytk&"&amp;sid="&sid&"'>"
dim reCount
reCount=conn.execute("Select count(ID) from [relist] where tid="&rs("id"))(0)
response.write ubb(rs("name"))&"</a><br/>"
response.write ubb(rs("fname"))&"("&rs("rc")&"/"
if reCount<=0 then
response.write ubb(reCount)
else
response.write "<a href=""relist.asp?tid="&rs("id")&"&amp;bbsid="&rs("bbsid")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&ubb(reCount)&"</a>"
end if
response.write")<br/>"
rs.moveNext
 	Next
	'response.write "<br/>"&chr(13)
	if page-pagecount<0 then response.write "<a href="""&gopage&"page="&page+1&""">下一页</a>"&chr(13)
	if page>1 then response.write "<a href="""&gopage&"page="&page-1&""">上一页</a>"&chr(13)

response.write "<br/>("&page&"/"&pagecount&")共"&count&"贴"
	if pagecount>1 then response.write "<input name=""page"" format=""*N"" value="""&page&""" type=""text"" maxlength=""5"" emptyok=""true"" size=""2""/><a href="""&gopage&"page=$(page)"">页</a>"

response.write "<br/>"
Else
response.write "暂时没有帖子！<br/>"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing

if ids<>"" and clng(ids)<>myid then
if TP=1 then
response.write "<a href=""alist.asp?tid="&tid&"&amp;ids="&ids&"&amp;TP=2&amp;saytk="&saytk&"&amp;sid="&sid&""">TA的回帖</a>"
else
response.write "<a href=""alist.asp?tid="&tid&"&amp;ids="&ids&"&amp;TP=1&amp;saytk="&saytk&"&amp;sid="&sid&""">TA的帖子</a>"
end if
else
if TP=1 then
response.write "<a href=""alist.asp?tid="&tid&"&amp;ids="&ids&"&amp;TP=2&amp;saytk="&saytk&"&amp;sid="&sid&""">我的回帖</a>"
else
response.write "<a href=""alist.asp?tid="&tid&"&amp;ids="&ids&"&amp;TP=1&amp;saytk="&saytk&"&amp;sid="&sid&""">我的帖子</a>"
end if

end if
if tid<>"" then
response.write "<br/><a href=""topic.asp?tid="&tid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">返回上级</a>"
end if
%>
<!--#include file="fanhui.asp"-->
<%call headsay()%>