<!--#include file="inc/config.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/function.asp"-->
<%
on error resume next
dim recpage,i,title,topn,stype,searchStr,countStr,resultArr
recpage=10
if not isempty(request("stype")) then 
		stype=Cint(request("stype"))
else 
		stype=0
end if
if not isempty(request("page")) then 
		currentpage=Cint(request("page"))
else 
		currentpage=1
end if
title=replace(replace(trim(request("keyword")),"'",""),"and","")	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>搜索</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
}
a.blues:link{ font-size:14px; text-decoration:underline; color:#003399; line-height:26px;}
a.blues:hover{ font-size:14px; text-decoration:underline; color:#003399; line-height:26px;}
a.blues:visited{ font-size:14px; text-decoration:underline; color:#003399; line-height:26px;}
a.blues:active{ font-size:14px; text-decoration:underline; color:#003399; line-height:26px;}
.a09 {color:#3C3C3C;font-size:12px;line-height:20px;}
.border_r{border-right:1px solid #074262;}
.style8 {color: #FFFFFF}  
.input_key{	border:1px solid #89A6D0; font-size:12px; height:16px; margin-bottom:1px; padding-top:3px; padding-left:5px;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css" />
<link href="news/style/news.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style9 {color: #FF0000}
.f {line-height:120%;font-size:100%;width:32em;padding-left:15px;word-break:break-all;word-wrap:break-word;}
.m {COLOR:#666666;font-size:100%;}
-->
</style>
</head>
<body>
<!--#include file="templet/head.htm"-->
<div class="br"></div>
<%
if(title<>"" and len(title)>0) then
%>
<form action="?" method="get">
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0" class="brd">
  <tr>
    <td height="30" align="center" background="news/images/search_bg.gif">关键字：
      <input name="KeyWord" type="text" class="input_key" id="KeyWord" size="50" value="<%=title%>" />
      <input name="button" type="submit" id="button" value="搜索" />
    </td>
  </tr>
</table>
</form>
<%  
  		dim offset
		offset=(currentpage-1)*recpage
		if offset=0 then
			offset=1
		else
			offset=offset+1
		end if
		if(stype=0) then
			searchStr="select top "&recpage&" id,title,content,moditime,pagepath,classid from news where id <=(select min(id) from (select top "&offset&" id from news where title like '%"&title&"%' order by id desc) as t) and title like '%"&title&"%' order by id desc"
			countStr="select count(*) from news where title like '%"&title&"%'"
		else
			searchStr="select top "&recpage&" id,title,content,moditime,pagepath,classid from news where id <=(select min(id) from (select top "&offset&" id from news where content like '%"&title&"%' order by id desc) as t) and content like '%"&title&"%' order by id desc"
			countStr="select count(*) from news where content like '%"&title&"%'"
		end if
		allrec=conn.execute(countStr)(0)
		totalpage=Cint((allrec-1+recpage)/recpage)
		set rs=server.createobject("adodb.recordset")
  		rs.open searchStr,conn,3,1
		if not rs.eof then
			resultArr=rs.GetRows()
		end if
		rs.close
	  	set rs=nothing
		if(isarray(resultArr)) then
			for i=0 to ubound(resultArr,2)			
	%>  
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="70"><a href="<%=resultArr(4,i)%>" class="blues" target="_blank"><%=resultArr(1,i)%></a><br>
        <%=gotTopic(RemoveHTML(resultArr(2,i)),150)%><br>
          <font color=#008000><%=resultArr(4,i)%>&nbsp;-&nbsp;<%=resultArr(3,i)%></font><br>
    </font></td>
  </tr>
</table>
<%
    		next
		else
			response.write("<p align=""center"">没有找到相关信息!</center>")
		end if
	  	
%>
<table width="960" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D4D0C8" style="line-height:24px; ">
  <tr>
  <td bgcolor="#F3F2F1">
  <form name="form1" method="post" action="" style="margin:0 0 0 0;">
    <div align="center">
<%
dim n,p
n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='search.asp?keyword="&title&"&stype="&stype&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='search.asp?keyword="&title&"&stype="&stype&"&page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
    </div>
  </form></td>
  </tr>
</table>
<%
else
%><table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="35"><form action="?" method="get">
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0" class="brd">
  <tr>
    <td height="30" align="center" background="news/images/search_bg.gif">关键字：
      <input name="KeyWord" type="text" class="input_key" id="KeyWord" size="50" />
      <input name="button" type="submit" class="input_search" id="button" value="搜索" />
    </td>
  </tr>
</table>
</form>
    </td>
  </tr>
</table>
<%
end if
%>
<!--#include file="templet/root.htm"-->
</body>
</html>
<%
call connclose()
%>
