<!--#include file="inc/functions.asp"-->
<!--#include file="inc/cnn.asp"-->
<%
tid=cnum(request("tid"))
id=cnum(request("id"))
action=request("action")
page=cnum(request("page"))
if page=0 then
	page=1
end if

if bbs_show=false and nowid="" then
	call go("log.asp?action=log")
end if
if action<>"" and nowid="" then
	call err("对不起，您尚未登录，不能执行此项搜索")
end if

sql2=""
list=""
select case action
	case "mine"
		sql="select topic from tie where writer='" & nowid & "'"
		record1.open sql,cnn,1,3
		for i=1 to record1.recordcount
			list=list & record1("topic")  & ","
			record1.movenext
		next
		record1.close
	if list="" then
		shownum=0
	else
		sql="select topic from tie where (topic in (" & list & ")  or zhiding=2) and parent<=0 order by zhiding,topic desc"
		record1.open sql,cnn,1,3
		allnum=record1.recordcount
		call getpages()
		if record1.recordcount>0 then
			record1.move (page-1)*bbs_mainnum
		end if
		list=""
		for i=1 to shownum
			list=list & record1("topic") & ","
			record1.movenext
		next
		record1.close
		if list="" then
			shownum=0
		else
			sql="select * from tie where topic in (" & list & ") order by zhiding,topic desc,xu"
			record1.open sql,cnn,1,3
		end if
	end if
		head=bbs_name & "-我的帖子"
	case "jinghua"
		sql="select topic from tie where parent=-1 or (zhiding=2 and parent<=0) order by zhiding,topic desc"
		record1.open sql,cnn,1,3
		allnum=record1.recordcount
		call getpages()
		if record1.recordcount>0 then
			record1.move (page-1)*bbs_mainnum
		end if
		for i=1 to shownum
			list=list & record1("topic") & ","
			record1.movenext
		next
		record1.close
		if list="" then
			shownum=0
		else
			sql="select * from tie where topic in (" & list & ") order by zhiding,topic desc,xu"
			record1.open sql,cnn,1,3
		end if
		head=bbs_name & "-系统精华"
	case "terday"
		sql="select topic from tie where (wtime>#" & date & "# or zhiding=2) and parent<=0 order by zhiding,topic desc"
		record1.open sql,cnn,1,3
		allnum=record1.recordcount
		call getpages()
		if record1.recordcount>0 then
			record1.move (page-1)*bbs_mainnum
		end if
		for i=1 to shownum
			list=list & record1("topic") & ","
			record1.movenext
		next
		record1.close
		if list="" then
			shownum=0
		else
			sql="select * from tie where topic in (" & list & ") order by zhiding,topic desc,xu"
			record1.open sql,cnn,1,3
		end if
		head=bbs_name & "-今日新帖"
	case "search"
		sql="select topic from tie where" & request("sql")
		record1.open sql,cnn,1,3
		for i=1 to record1.recordcount
			list=list & record1("topic")  & ","
			record1.movenext
		next
		record1.close
		if list="" then
			shownum=0
		else
			sql="select topic from tie where topic in (" & list & ") and parent<=0 order by topic desc"
			record1.open sql,cnn,1,3
			allnum=record1.recordcount
			call getpages()
			if record1.recordcount>0 then
				record1.move (page-1)*bbs_mainnum
			end if
			list=""
			for i=1 to shownum
				list=list & record1("topic") & ","
				record1.movenext
			next
			record1.close
			if list="" then
				shownum=0
			else
				sql="select * from tie where topic in (" & list & ") order by zhiding,topic desc,xu"
				record1.open sql,cnn,1,3
			end if
		end if
		head=bbs_name & "-搜索"
	case "newre"
		sql="select topic from tie where parent<=0 order by zhiding,lasttime desc"
		record1.open sql,cnn,1,3
		allnum=record1.recordcount
		call getpages
		if record1.recordcount>0 then
			record1.move (page-1)*bbs_mainnum
		end if
		for i=1 to shownum
			list=list & record1("topic") & ","
			record1.movenext
		next
		record1.close
		if list="" then
			shownum=0
		else
			sql="select * from tie where topic in (" & list & ") or zhiding=2 order by zhiding,lasttime desc,xu"
			record1.open sql,cnn,1,3
		end if
		head=bbs_name & "-最新回复"
	case "hot"
		sql="select topic from tie where parent<=0 order by zhiding,allre desc"
		record1.open sql,cnn,1,3
		allnum=record1.recordcount
		call getpages
		if record1.recordcount>0 then
			record1.move (page-1)*bbs_mainnum
		end if
		for i=1 to shownum
			list=list & record1("topic") & ","
			record1.movenext
		next
		record1.close
		if list="" then
			shownum=0
		else
			sql="select * from tie where topic in (" & list & ") order by zhiding,allre desc,xu"
			record1.open sql,cnn,1,3
		end if
		head=bbs_name & "-最热主题"
	case "newtie"
		sql="select topic from tie where parent<=0 order by zhiding,topic desc"
		record1.open sql,cnn,1,3
		allnum=record1.recordcount
		call getpages
		if record1.recordcount>0 then
			record1.move (page-1)*bbs_mainnum
		end if
		for i=1 to shownum
			list=list & record1("topic") & ","
			record1.movenext
		next
		record1.close
		if list="" then
			shownum=0
		else
			sql="select * from tie where topic in (" & list & ") or zhiding=2 order by zhiding,topic desc,xu"
			record1.open sql,cnn,1,3
		end if
		head=bbs_name & "-最新回复"

	case else
		action=""
end select
if action="" then
	if tid=0 then
		sql="select topic from tie where parent<=0 order by zhiding,lasttime desc"
		record1.open sql,cnn,1,3
		allnum=record1.recordcount
		call getpages
		if record1.recordcount>0 then
			record1.move (page-1)*bbs_mainnum
		end if
		for i=1 to shownum
			list=list & record1("topic") & ","
			record1.movenext
		next
		record1.close
		if list="" then
			shownum=0
		else
			sql="select * from tie where topic in (" & list & ") order by zhiding,lasttime desc,xu"
			record1.open sql,cnn,1,3
		end if
		head=bbs_name
	else
		if showtoall(tid)=false and nowid="" then
			call err("此板块只对会员开放,请先登录或注册.")
		end if
		sql="select topic from tie where parent<=0 and (tid=" & tid & " or zhiding=2) order by zhiding,topic desc"
		record1.open sql,cnn,1,3
		allnum=record1.recordcount
		call getpages
		if record1.recordcount>0 then
			record1.move (page-1)*bbs_mainnum
		end if
		for i=1 to shownum
			list=list & record1("topic") & ","
			record1.movenext
		next
		record1.close
		if list="" then
			shownum=0
		else
			sql="select * from tie where topic in (" & list & ") order by zhiding,topic desc,xu"
			record1.open sql,cnn,1,3
		end if
		head=bbs_name & "-" & tidname(tid)
	end if
end if


'==================================================
sub getpages()
	allpages=mint(allnum/bbs_mainnum)
	if page>allpages then
		page=allpages
	end if
	if page<=0 then
		page=1
	end if
	shownum=min(allnum-bbs_mainnum*(page-1),bbs_mainnum)
end sub
'====================================================
shownum=cnum(shownum)

%>







<!--#include file="inc/head.asp"-->
<div align="center">
<table border="1" style="border-collapse: collapse; border-left-width:0; border-top-width:0; border-bottom-width:0" width="<%=bbs_width%>" id="table2" bordercolor="<%=color_line%>" cellpadding="2">
	<tr bgcolor="<%=color_dan%>" class="热点菜单">
		<td style="border-bottom:medium none #000000; border-top-style: none; border-top-width: medium; border-right-style:none; border-right-width:medium; border-left-style:solid; border-left-width:1px">
<%
response.write "返回结果 " & allnum & " 篇："
response.write showpage("index.asp?sql=" & server.urlencode(request("sql")) & "&action=" & action & "&tid=" & tid & "&",allpages,page)
%>　</td>
		<td style="border-left-style:none; border-left-width:medium; border-right-style:solid; border-right-width:1px; border-top-style:none; border-top-width:medium; border-bottom-style:none; border-bottom-width:medium" width="45%">

		<a href="index.asp?action=terday">今日新帖</a>
		<a href="index.asp?action=mine">我的帖子</a>
		<a href="index.asp?action=jinghua">系统精华</a> 
		<a href="index.asp?action=newtie">最新主题</a> 
		<a href="index.asp?action=newre">最新回复</a> 
		<a href="index.asp?action=hot">最热主题</a></td>
	</tr>
	</form>
</table>
</div>
<%
dim lastul,renum
lastul=0
%>
<div align="center">
<table border="1" cellpadding="4" cellspacing="0" style="border-collapse: collapse; " width="<%=bbs_width%>" id="table3" bordercolor="<%=color_line%>">
	<tr>
		<td style="border-top-style: none; border-top-width: medium" class="标题">
			<table border="1" cellpadding="2" style="border-collapse: collapse" width="100%" bordercolor="<%=color_line%>" id="table7" class="帖子底色">
				<tr>
					<td>









<%
if shownum>0 then
	response.write bbs_ul
	call showmain(shownum)
	response.write bbs_ul2
else
	response.write "<b>无匹配帖子</b>"
end if
%>











</td>
				</tr>
			</table>
		</div>
		</td>
	</tr>
</table>


</div>



<div align="center">
	<table border="0" cellpadding="2" style="border-collapse: collapse" width="<%=bbs_width%>" bordercolor="<%=color_line%>" id="table8">
		<tr class="热点菜单">
			<td style="border-left-style: solid; border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-bottom-style:solid; border-bottom-width:1px">
<%
			response.write "返回结果 " & allnum & " 篇"
response.write showpage("index.asp?sql=" & server.urlencode(request("sql")) & "&action=" & action & "&tid=" & tid & "&",allpages,page)
%>
</td>
		</tr>
	</table>
<br>
	<table border="1" cellpadding="4" style="border-collapse: collapse" width="<%=bbs_width%>" id="table5" bgcolor="<%=color_dan%>" bordercolor="<%=color_line%>" cellspacing="0">
		<tr>
			<td class="普通深色">友情链接</td>
		</tr>
		<tr class="普通淡色">
			<td>
<%
if bbs_ljnum>=0 then
	for i=0 to bbs_ljnum
%>
<a href="<%=bbs_lj_url(i)%>" target="_blank"><img border="0" src="<%=bbs_lj_logo(i)%>" width="88" height="31" title="<%=bbs_lj_js(i)%>"></a>
<%
	next
end if
%>
			</td>
		</tr>
</table>
<br>
	<table border="1" cellpadding="4" style="border-collapse: collapse" width="<%=bbs_width%>" id="table5" bordercolor="<%=color_line%>" cellspacing="0">
		<tr>
			<td class="普通深色">当前在线 <%=bbs_usnum%> 人（不计游客）　<%
application("max_online")=cnum(application("max_online"))

if application("max_online")<bbs_usnum  then
application("max_online")=bbs_usnum
application("max_time")=now
end if
response.write "最高记录在 "  & application("max_online") & " 个会员在线，于 " & application("max_time")
%></td>
		</tr>
		<tr class="普通淡色">
			<td>
				<table border="1" cellpadding="4" cellspacing="1" style="border-collapse: collapse" width="100%" bordercolor="<%=color_line%>" id="table6" class="在线">
<%
for i=1 to bbs_usnum
	if i mod 10=1 then
		response.write "<tr>"
	end if
		response.write "<td width='10%'><p title='停留：" & timedf(bbs_lasttime(i-1)) & "'>" & showperson(bbs_users(i-1)) & "</p></td>"
	if i mod 10=0 or i=bbs_usnum then
		response.write "</tr>"
	end if
next
	%>
				</table>
			</td>
		</tr>

<%
if tid<>0 then				
	response.write "<tr align='right' class='普通淡色'><td>版主："

	adms=application("tid" & tid & "_ads")
	if adms<>"" then
		ads=split(adms,",")
		for i=0 to ubound(ads)
			response.write showperson(ads(i)) & " "
		next
	end if
	response.write "</td></tr>"
end if
%>
</table>
</div>

<script src="http://www.sanbon.com.cn/counts/count.asp?view=bbs&fy=2"></script>

</body>

</html>
<!--#include file="inc/bottom.asp"-->