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







call head()

dim TP,Action,bbsid,Act
bbsid=Request("bbsid")
Act=Request("Act")
Action=Request("Action")
IF  Action="ok" Then
	call search
else

	call main
end if
sub main
if act="zone" then
Call saycardd("搜索家族")



else
Call saycardd("搜索论坛")

end if




 if saytk<>1 then
	Response.write "<form name=""form"" method=""post"" action=""searchbbs.asp?saytk="&saytk&"&amp;sid="&sid&""">"
end if
response.write "请输入关键词:<br/>"
response.write "<input name=""keyword"" value="""" title=""输入关键词""/><br/>"
if saytk<>1 then
response.write "<input type=""hidden"" name=""action"" value=""ok""/>"
response.write "<input type=""hidden"" name=""bbsid"" value="""&bbsid&"""/>"
response.write "<input type=""hidden"" name=""Act"" value="""&act&"""/>"

%>
<input type="submit" name="Submit" value="确认搜索"></form><br/><%
else
response.write "<anchor>确认搜索<go href=""searchbbs.asp?saytk="&saytk&"&amp;sid="&sid&""" method=""post"">"
response.write "<postfield name=""keyword"" value=""$(keyword)""/>"
response.write "<postfield name=""Action"" value=""ok""/>"
response.write "<postfield name=""bbsid"" value="""&bbsid&"""/>"
response.write "<postfield name=""Act"" value="""&act&"""/>"
response.write "</go></anchor><br/>"
end if
end sub

sub search



Call saycardd("搜索结果")







dim keyword
keyword=request("keyword")
if keyword="" then
  Call Error("关键字不能为空！")
  end if
dim gettxt
if act="zone" then
gettxt="select * from ydbbs where yc=0 and city=2 and name like '%" & keyword & "%'"
else
gettxt="select * from ydbbs where yc=0 and city=0 and name like '%" & keyword & "%'"
end if
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="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
response.write "<br/><a href=""searchbbs.asp?act="&act&"&amp;bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">重新搜索</a><br/>"
end sub
conn.close
set conn=nothing
if act="zone" then
response.write "<a href=""zone.asp?saytk="&saytk&"&amp;sid="&sid&""">家族交流</a>"
else
response.write "<br/><a href=""search.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">论坛搜索</a>"
end if
%>
<!--#include file="fanhui.asp"-->
<%
call headsay()
%>