<!-- #include file="Inc.asp" -->
<!--#include file="ydzq1.asp"-->
<%
call head()

dim TP,ids,Action,bbsid
bbsid=Request("bbsid")
if bbsid<>"" then
if bbsid="" or Isnumeric(bbsid)=False then
  Call Error("论坛ID无效！")
  end if
dim namebbs
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select name from ydbbs where id="&bbsid,conn,1,1
if rs.eof then
  Call Error("论坛不存在！")
  end if
namebbs=rs("name")
rs.close
set rs=nothing
  end if
Action=Request("Action")




Call saycarda("搜索结果")

dim keyword,sear,sear2,times
keyword=request("keyword")
if keyword="" then
  Call Error("关键字不能为空！")
  end if
sear=request("sear")
if sear="" or IsNumeric(sear)=False then
  Call Error("搜索类型无效！")
  end if
sear2=clng(request("sear2"))
if sear2="" or IsNumeric(sear2)=False then
  Call Error("搜索范围无效！")
  end if
if sear=1 then
times=request("times")
if times="" or IsNumeric(times)=False then
  Call Error("发表时间无效！")
  end If
  
dim gettxt
gettxt="select * from sell where yc=0"


gettxt= gettxt & " and name like '%" & keyword & "%'"
  if sear2=1 then
	if bbsid="" or Isnumeric(bbsid)=False then
	  Call Error("论坛ID无效！")
	  end if
  gettxt= gettxt & "and bbsid="&bbsid&""
  end if


	



times=clng(times)
if times=1 then 
gettxt=gettxt & "and "&datediff("d",Now(),tm)&"<7"
elseif times=2 then 
gettxt=gettxt& " and "&datediff("d",NOw(),tm)&"<30"
else
gettxt=gettxt & "and "&datediff("d",NOw(),tm)&"<90"
end if

  gettxt = gettxt & " ORDER BY ID DESC"

set rs=Server.CreateObject("ADODB.Recordset")
rs.open gettxt,conn,1,1
If Not rs.eof	Then
Dim PageSize,i
	PageSize=10							
	Dim Count,page,pagecount,gopage	
	gopage="search.asp?sid="&sid&"&amp;Action=ok&amp;keyword="&keyword&"&amp;sear="&sear&"&amp;sear2="&sear2&"&amp;times="&times&"&amp;saytk="&saytk&"&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))
        response.write ("共:"&count&"条相关帖子<br/>")				
	For i=1 To PageSize       						
	If rs.eof Then Exit For	
response.write ""&i+(page-1)*PageSize&"."
        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 "<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="&rs("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
rs.close
set rs=Nothing
ElseIf sear=10 then 
'==========================

gettxt="select ID,name from users where name like '%" & keyword & "%'"







set rs=Server.CreateObject("ADODB.Recordset")
rs.open gettxt, conn,1,1
If Not rs.eof	Then

	PageSize=10							

	gopage="searchuser.asp?Action=ok&amp;bbsid="&bbsid&"&amp;keyword="&keyword&"&amp;sear="&sear&"&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))
        response.write ("共:"&count&"位会员<br/>")				
	For i=1 To PageSize       						
	If rs.eof Then Exit For	
response.write ""&i+(page-1)*PageSize&"."
Response.write "<a href=""uinfo.asp?id="&rs("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&ubb(rs("name"))&"(ID:"&usb(rs("id"))&")</a><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

ElseIf sear=11 then 

'========================
gettxt="select * from ydbbs where yc=0 and city=0 and name like '%" & keyword & "%'"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open gettxt, conn,1,1
If Not rs.eof	Then

	PageSize=10							

	gopage="searchbbs.asp?Action=ok&amp;act="&act&"&amp;keyword="&keyword&"&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&"."
response.write "<a href='board.asp?bbsid="&rs("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&"'>"
response.write ubb(rs("name"))&"</a><br/>"
rs.moveNext
 	Next
	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


End if















conn.close
set conn=Nothing
If saytk=1 then
Response.write "<anchor>返回上级<prev/></anchor>"
End if
response.write "<br/><a href=""searchuser.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">搜索会员</a>"
response.write "<br/><a href=""searchbbs.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">搜索论坛</a>"
response.write "<br/><a href=""/so.asp?saytk="&saytk&"&amp;sid="&sid&""">搜索资源</a>"
%>
<!--#include file="fanhui.asp"-->
<%Call headsay()%>