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

<%call head()

dim bbsid,ptype
bbsid=trim(request.QueryString("bbsid"))
ptype=trim(request.QueryString("ptype"))

If bbsid="" Then bbsid=usb(request("bbsidoo"))
if bbsid="" or Isnumeric(bbsid)=false then
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse&"""><p>ID无效！")
else
  Call Error("<card title='出错了'><p>ID无效！")
end if
end if
if ptype="" or Isnumeric(ptype)=false then
ptype=0
end if
ptype=abs(ptype)

dim namebbs,vicexs,hyin,shuo,prentID,oopp,myjbin,myjyin,cityon,groupkf,logo
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select name,logo,shuo,id,prentID,hyin,vipin,vicexs,oopp,myjbin,myjyin,city, groupkf from ydbbs where yc=0 and lx=1 and id="&bbsid,conn,1,1
if rs.eof then
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse&"""><p>无此论坛！")
else
  Call Error("<card title='出错了'><p>无此论坛！")
end if
end if
namebbs=rs("name")
logo=rs("logo")
cityon=rs("city")
shuo=rs("shuo")
prentID=rs("prentID")
hyin=rs("hyin")
vipin=rs("vipin")
vicexs=rs("vicexs")
oopp=rs("oopp")
myjbin=rs("myjbin")
myjyin=rs("myjyin")
groupkf=rs("groupkf")
grouptxt=rs("grouptxt")
rs.close
set rs=nothing

if oopp=1 and keys<>1 then
browsers=Lcase(Left(Request.ServerVariables("HTTP_USER_AGENT"),4))
if browsers="oper"  or  browsers="winw"  or  browsers="wapi" or browsers="mc21" or browsers="up.b" or browsers="upg1" or browsers="upsi" or browsers="qwap" or browsers="jigs" or browsers="java" or browsers="alca" or browsers="wapj" or browsers="cdr/" or browsers="nec-" or browsers="fetc" or browsers="r380" or browsers="winw" or browsers="mozi" or browsers="mozi" or browsers="m3ga" then 
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse&"""><p>请用手机访问！")
else  
Call Error("<card title='出错了'><p>请用手机访问！")
end if
end if
end if
if myjbin<>0 then
if clng(myjb)<myjbin then 
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse&"""><p>"&getcent&"不足"&myjbin&"不能浏览本版！")
else 
  Call Error("<card title='出错了'><p>"&getcent&"不足"&myjbin&"不能浏览本版！")
end if
end if
end if
if myjyin<>0 then
if clng(myjy)<myjyin then 
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse&"""><p>经验不足"&myjyin&"不能浏览本版！！")
else 
  Call Error("<card title='出错了'><p>经验不足"&myjyin&"不能浏览本版！")
end if
end if
end if
if hyin=2 and keys<>1 and skey=0 and adminzone<>abs(bbsid) then 
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse&"""><p>只限版主进入！")
else 
  Call Error("<card title='出错了'><p>只限版主进入！")
end if
end if
if hyin=1 and myid=0 then 
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse&"""><p>只限会员进入！")
else 
  Call Error("<card title='出错了'><p>只限会员进入！")
end if
end if
if keys<>1 and skey<>abs(bbsid) and adminzone<>abs(bbsid) then 
if clng(vipin)>0  then
if clng(getvip(myjb,myjy))<clng(vipin) and clng(vipdj)<clng(vipin) and abs(bbsid)<>skey and keys<>1 then
if saytk>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse&"""><p>只限VIP"&clng(vipin)&"级会员进入！")
else 
  Call Error("<card title='出错了'><p>只限VIP"&clng(vipin)&"级会员进入！")
end if
end if
end if
end if

if myid<>0 then
mz="[url=/bbs/uinfo.asp?id="&myid&"&amp;sid=[sid]&saytk=[saytk]]"&myni&"[/url]"
else
mz="游客"
end if
conn.execute("insert into sqdt(shijian,dz)values('"&now&"','"&mz&"去了:(url=/bbs/board.asp?bbsid="& bbsid &"&amp;sid=[sid]&saytk=[saytk])"&namebbs&"(/url)')")

if cityon=1 Then
Call saycardd("同城-"&namebbs&"")

elseif cityon=2 then
if groupkf=1 and myid=0 then 
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse&"""><p>只限本组群成员进入！！")
else 
  Call Error("<card title='出错了'><p>只限本组群成员进入！")
end if
end if
if groupkf=1 then
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select zoneID from users where id="&myid,conn,1,1
if rs("zoneID")<>clng(bbsid) and keys<>1 and adminzone<>abs(bbsid) then 
if saytk<>1 then
  Call Error("<title>出错</title></head><body><body bgcolor="""&yanse&"""><p>只限本组群成员进入！！")
else 
  Call Error("<card title='出错了'><p>只限本组群成员进入！")
end if
end if
rs.close
set rs=nothing
end If
Call saycarda(""&namebbs&"")

Else
Call saycarda(""&namebbs&"")

end if

%>
<!--#include file="sy1.asp"-->
<%

If saytk=100 Then Response.write "<div class=""nav"">"
response.write "<a href=""writetext.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">发贴</a>|"
response.write "<a href=""bbs_vip.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><br/>"
if cityon=2 then
response.write "<a href=""zonetax.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">基金</a>|"
response.write "<a href=""chaturl.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">群聊</a>|"
response.write"<a href=""zoneman.asp?id="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">成员</a>|"
response.write"<a href=""zonefav.asp?action=in&amp;id="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">加入</a><br/>"&chr(13)
    end If
    
response.write "<a href=""feel.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">浏览</a>|"
response.write "<a href=""bbs_vip.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">版务</a>|"
response.write "<a href=""bbsonline.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">在线</a>|"
response.write "<a href=""search.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">搜索</a><br/>"&chr(13)
If saytk=100 Then Response.write "</div><div class=""path red"">当前:"

if ptype=1 then
response.write "<a href=""board.asp?bbsid="&bbsid&"&amp;sid="&sid&"&amp;saytk="&saytk&""">按跟帖时间浏览</a><br/>"
else
response.write "<a href=""board.asp?bbsid="&bbsid&"&amp;ptype=1&amp;sid="&sid&"&amp;saytk="&saytk&""">按发表时间浏览</a><br/>"
end if    

If saytk=100 Then Response.write "</div>"



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

Response.write ""&namebbs&"<br/>"

If logo<>"" Then
Response.write "<img src='"&logo&"' alt='.' /><br/>"
  End if

if vicexs=1 Then
Response.write "公告:"
Response.write ""&ubb(shuo)&""
If keys=1 Or keys=2 Or keys=3 or skey=abs(bbsid) then
Response.write "<a href='vice.asp?bbsid=" & bbsid & "&amp;saytk="&saytk&"&amp;sid="&sid&"'>修改</a>"
End if
response.write"<br/>"&chr(13)
end if





'-------------------
'随机广告开始
if adsetkf("ads2")=1 then
call adstr1(1,2,13,0)
end if
'-------------------
'----------滚动显示一条
 Set rs = Server.CreateObject("ADODB.Recordset")
 rs.open "SELECT ID,bbsid,name from sell where yc = 0 and bbsid="&bbsid&" and topsell=1 order by id desc",conn,1,1
if not rs.eof then
  
      dim gdranNum 
	   Randomize()  
gdranNum = int(rs.recordCount*rnd)+1 
for i=1 to Rs.Recordcount
if i=gdranNum then
dim titlerr
    titlerr=left(rs("name"),15)
   if len(rs("name"))>15 then
    titlerr=titlerr+".."
   End if
    Response.write "[滚]<a href='bbsro.asp?bbsid="&rs("bbsid")&"&amp;ID="&rs("ID")&"&amp;saytk="&saytk&"&amp;sid="&sid&"'>"&titlerr&"</a><br/>"
	exit for
	end if
 rs.movenext
 if rs.eof then exit for
next 
end if
  rs.close
  set rs=Nothing
'----------滚动显示一条

set rs=Server.CreateObject("ADODB.Recordset")
if ptype=1 then
rs.open"select * from sell where yc=0 and bbsid="&bbsid&" order by ID desc",conn,1,1
else
rs.open"select * from sell where yc=0 and bbsid="&bbsid&" order by num,retime desc",conn,1,1
end if
If Not rs.eof	Then
	Dim PageSize,i
	PageSize=10					
	Dim Count,page,pagecount,gopage			
	gopage="board.asp?ptype="&ptype&"&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("<b>[顶]</b>")
    if rs("num")=20 then response.write("<b>[固]</b>")
    if rs("jj")=1 then response.write("<b>[精]</b>")
    if rs("st")=1 then response.write("<b>[锁]</b>")
    if rs("lx")=2 then response.write("<b>[投]</b>")
    if rs("lx")=4 then response.write("<b>[隐]</b>")
    if rs("lx")=5 then response.write("<b>[币]</b>")
    if rs("paycent")<>0 then response.write("<b>[卖]</b>")
    if rs("x")=>10 then response.write"<img src='/bbs/jia/1.gif' alt='hot'/>"
  if rs("tzdj")<>0 then
response.write"<img src="""&rs("tzdj")&""" alt='.'/>"
end if
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"))
response.write "</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/>"
If saytk=100 Then Response.write "<div class=""zd""></div>"
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

'记录最后页面
 if myid<>0 then
 Dim sql
 if clng(endleibie)<>clng(bbsid) then
  sql="update Users set endleibie="&bbsid&" Where id="&myid
  
  Application.Lock
  conn.execute(sql)
  If datesql=1 then
  conn.Execute("update Users set endleibie=0 where DATEDIFF('s', times, now()) > 60*60 and id="&myid&"")
  End if
  Application.Unlock
 end if
 end if


'更新在线人数
 dim Soduser
If datesql=0 then
 set rs=server.CreateObject("ADODB.RecordSet")
 rs.Open "select ID from Users where tjj >= '"&DateAdd("n", lonline, Now())&"' and endleibie="&bbsid,conn,1,1

 Soduser = rs.RecordCount

 rs.close
 set rs=Nothing
Else
Soduser=conn.execute("Select count(ID) from users where endleibie="&bbsid&"")(0)
End if
dim topuser
 set rs=server.CreateObject("ADODB.RecordSet")
 rs.Open "select topuser,toduser from ydbbs where ID="&bbsid,conn,1,2
 rs("toduser")=Soduser
 if clng(Soduser) > rs("topuser") then
 rs("topuser")=Soduser
 end if
 rs.update
 topuser=rs("topuser")
 rs.close
 set rs=nothing
 toduser=Soduser
conn.execute("update Users set endleibie="&bbsid&" where ID="&myid)
If toduser="" Then toduser=0 
If saytk=100 Then Response.write "<div class=""path"">"
response.write "<a href=""bbsonline.asp?bbsid="&bbsid&"&amp;sid="&sid&"&amp;saytk="&saytk&""">在线会员("&toduser&")</a><br/>"&chr(13)


'===============================

If saytk=100 Then Response.write "</div>"


'-------------------
'随机广告开始
if adsetkf("ads2")=1 then
call adstr1(1,2,13,0)
end if
'-------------------

if cityon=1 then
response.write "<a href=""city.asp?saytk="&saytk&"&amp;sid="&sid&""">&gt;&gt;同城交友</a><br/>"
end if
if cityon=2 then
response.write "<a href=""zone.asp?saytk="&saytk&"&amp;sid="&sid&""">返回家族首页</a><br/>"
end If





if prentID<>0 and cityon=0 Then

Response.write "<a href=""findex.asp?id="&prentID&"&amp;saytk="&saytk&"&amp;sid="&sid&""">[返回论坛中心]</a>"

elseif prentID<>0 and cityon=1 then
Response.write "<a href=""Citylist.asp?id="&prentID&"&amp;saytk="&saytk&"&amp;sid="&sid&""">上级</a>|"
Response.write "<a href=""index.asp?saytk="&saytk&"&amp;sid="&sid&""">社区</a>>>"
end If


Function CreatedTextFiles(FileName,body)
'On Error Resume Next
If InStr(FileName, ":") = 0 Then FileName = Server.MapPath(FileName)
	Dim oStream
	Set oStream = CreateObject("ADODB.Stream")
	oStream.Type = 2 
	oStream.Mode = 3 
	oStream.Charset = "GB2312"
	oStream.Open
	oStream.Position = oStream.Size
	oStream.WriteText body
	oStream.SaveToFile FileName, 2
	oStream.Close
	Set oStream = Nothing
	If Err.Number <> 0 Then Err.Clear
	End Function
'================================================
dim cont_file,path_File

if myid<>0 then
mz="[url=uinfo.asp?id="&myid&"&amp;[标识]]"&myni&"[/url]"
else
mz="游客"
end if
conn.execute("insert into sqdt(shijian,dz)values('"&now&"','"&mz&"进入了(url=/bbs/board.asp?bbsid="&bbsid&"&amp;saytk=[saytk]&amp;sid=[sid])"&namebbs&"(/url)论坛')")

conn.close
set conn=nothing
%>
<!--#include file="fanhui.asp"-->
<%call head1()%>