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

<%call head()
Call saycarda("专题")
dim bbsid,ID
id=trim(request.QueryString("id"))
bbsid=trim(request.QueryString("bbsid"))

if id="" or Isnumeric(id)=false then
  Call Error("<card title='出错了'><p>ID无效！")
end if
if bbsid="" or Isnumeric(bbsid)=false then
  Call Error("<card title='出错了'><p>ID无效！")
end if

'检查有几条新留言
dim newguest
newguest = 0
IF myid > 0 THEN
  newguest = ForNewGuest(myid)
END IF
dim bbsname
    set rs=server.createobject("adodb.recordset")
  rs.open" select title from bbszt where bbsid="&bbsid&" and ID="&ID,conn,1,1
    if rs.eof then
  Call Error("不存在的记录！")
  end if
  bbsname=rs("title")
  rs.close
  set rs=nothing


if myid<>0 then
if newguest > 0 then
Response.write "<br/><img src='/bbs/xi.gif' alt='.' /><a href='/bbs/msgview.asp?url=" & Replace(Replace(R_url(), "sid=", "o="), "sid=", "o=") & "&amp;saytk="&saytk&"&amp;sid="&sid&"'>您有(" & newguest & ")条新消息</a><br/>" & Chr(13)
end if
else
Response.write "欢迎您:<a href='login.asp?url=/bbs/board.asp?bbsid="&bbsid&"'>登陆/注册</a><br/>"& chr(13)
end if

response.write "<a href=""writetext.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">发贴</a>|"

response.write "<a href=""elist.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">精华</a>|"
response.write "<a href=""bbszt.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">专题</a>|"

response.write "<a href=""board.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">全部</a><br/>"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from sell where yc=0 and bbsid="&bbsid&" and ztid="&id&" order by ID desc",conn,1,1
If Not rs.eof	Then
	Dim PageSize,i
	PageSize=listnum					
	Dim Count,page,pagecount,gopage			
	gopage="ztlist.asp?id="&id&"&amp;bbsid="&bbsid&"&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	
        dim nowtx
        if rs("fs")=1 then
        nowtx="综合"
        elseif rs("fs")=2 then 
        nowtx="经验"
        elseif rs("fs")=3 then 
        nowtx="分享"
        elseif rs("fs")=4 then
        nowtx="提问"
        else 
        nowtx="综合"
        end if
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("[隐]")
    if rs("lx")=5 then response.write("[币]")
    if rs("paycent")<>0 then response.write("[卖]")
response.write "<a href='topic.asp?tid="&rs("id")&"&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"))&"/"&nowtx&"/"&ubb(rs("rc"))&"/"
if reCount<=0 then
response.write reCount
else
response.write "<a href=""relist.asp?tid="&rs("id")&"&amp;bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&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

Response.write "<a href=""board.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">返回本版</a>|"

Response.write "<a href=""index.asp?saytk="&saytk&"&amp;sid="&sid&""">社区首页</a><br/>"

Response.write "现在时间:"&time()&"<br/>"
dim ttt
ttt=FormatNumber((timer()-tss)*1000,3)
'response.write "页面执行:" & ttt & "毫秒<br/>"&chr(13)
conn.close
set conn=nothing
Call headsay()
%>