<!-- #include file="Inc/Inc.asp" -->
<!-- #include file="Inc/Function.asp" -->
<%call head
Call saycardd("搜索结果")%>
<%dim keyword,sear
keyword=request("keyword")
if keyword="" then
  Call Error("关键字不能为空！")
  end if
sear=request("sear")
if sear="" or IsNumeric(sear)=False then
  Call Error("搜索类型无效！")
  end if
sear=clng(sear)
if sear=1 then
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from sms where title like '%"&keyword&"%' order by [ID] desc",conn,1,1
else
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from sms where test like '%"&keyword &"%' order by [ID] desc",conn,1,1
end if
If Not rs.eof	Then
Dim PageSize,i
	PageSize=10							
	Dim Count,page,pagecount,gopage	
	gopage="search.asp?sid="&sid&"&amp;keyword="&keyword&"&amp;sear="&sear&"&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))
		If saytk=100 Then
	response.write ("<div class=""path"">您搜索的关键字为："&keyword&"</div>")
	else
        response.write ("您搜索的关键字为："&keyword&"<br/>")
	End if
	If saytk=100 Then
	response.write ("<div class=""path"">共搜索到"&count&"条相关文章</div>")
	else
        response.write ("共搜索到"&count&"条相关文章<br/>")
	End if
	For i=1 To PageSize       						
	If rs.eof Then Exit For	
	dim Counts
Counts=conn.execute("Select count(ID) from [pl] where smsid="&rs("ID"))(0)		
Response.write "<a href=""article.asp?class="&rs("classid")&"&amp;id="&rs("id")&"&amp;sid="&sid&"&amp;saytk="&saytk&""">"&i+(page-1)*PageSize&"."&ubb(rs("title"))&"</a><br/>" 
	rs.moveNext 								
	Next	
	if page-pagecount<0 then response.write "<a href="""&gopage&"page="&page+1&""">下页</a>"
	if page>1 then response.write "<a href="""&gopage&"page="&page-1&""">上页</a>"
	if pagecount>1 then response.write "<br/><b>"&page&"</b>/"&pagecount&"页<input name=""page"" format=""*N"" value="""&page&""" type=""text"" maxlength=""5"" emptyok=""true"" size=""3""/><a href="""&gopage&"page=$(page)"">[GO]</a><br/>"
Else
If saytk=100 Then
	response.write ("<div class=""path"">没有符合条件< "&keyword&" >的文章</div>")
	else
        response.write "没有符合条件"&keyword&"的文章<br/>"
	End if

end if
rs.close
set rs=nothing
conn.close
set rs=nothing

If saytk=100 Then Response.write "<div class=""path"">"
If saytk=1 Then 
response.write"----------<br/>"
response.write"<anchor>返回上级<prev/></anchor><br/>"
Else
response.write"<a href=""javascript:window.history.go(-1);"">>>返回上一页</a><br/>"
End If
If saytk=100 Then Response.write "</div>"

response.write"<br/><a href='index.asp?sid="&sid&"&amp;saytk="&saytk&"'>>>返回首页</a>"

Call Headsay()
%>                         