<%
dim startime,endtime
startime=timer()
%> 
<!--#include file="../include/Conn.jsp"-->
<!--#include file="../include/Char.jsp"-->
<!--#include file="../include/function.jsp"-->
<!--#include file="../include/ubbcode.jsp"-->
<!--#include file="../Include/const.jsp" -->
<%dim idArr
m_keywords=CheckStr(trim(request("keywords")))
if m_keywords<>"" then
idArr=split(site_info(10),",")
for i = 0 to ubound(idArr)
m_keywords=replace(m_keywords,idArr(i),"")
next
i=0
end if				
%>
<html>
<head>
<title>运城搜索-<%=Request("keywords")%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="description" content="运城搜索是立足于运城本地的搜索引擎。提供运城吃喝玩乐住行游等方面信息的搜索查询。">
<meta name="keywords" content="运城,运城生活,生活消费,休闲娱乐,时尚,家政,安居,旅游,购物,美食,交友,俱乐部,特约商户,消费打折">
<!--#include file="Include/style.css"-->
</head>
<body>
<!--#include file="include/top.inc"-->
<%
    dim m_RecordCount,m_PageNo,m_Page
    m_RecordCount=0 : m_PageNo=0 : m_Page=0
	m_PageSize = 20 '每页显示数录数
    m_PageNo = Trim(Request.querystring("PageNo"))
	Set rs = Server.createobject("Adodb.RecordSet")
	m_Parameter = "Keywords="&m_Keywords
    m_SQL = "SELECT * FROM T_Article where F_Keywords like  '%" & m_Keywords & "%'"
		
    m_SQL = m_SQL +" or F_Title like  '%" & m_Keywords & "%'"
	m_SQL = m_SQL +" or F_Content like  '%" & m_Keywords & "%'"
	m_SQL = m_SQL +" ORDER BY F_ID DESC"
	rs.open m_SQL,conn,1,1
	 m_RecordCount = rs.RecordCount
      rs.PageSize = m_PageSize
      m_Page = rs.PageCount%>
	 <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TR>
    <TD vAlign=bottom width="63%" height=35 class="result_content"><STRONG>&nbsp;&nbsp;<% if m_Keywords<>"" then %>
        &quot;<LABEL><%=m_Keywords%></LABEL>&quot; <% end if %>相关网页</STRONG></SPAN> 共找到<span class="result_highlight"><%=m_RecordCount%></span> 个(耗时 <% endtime=timer() %><%=FormatNumber((endtime-startime),3,-1)%>秒)
        </TD>
   
  </TR>
</TABLE>
<%if rs.Eof then%>
 <DIV id=divInfoList>
	  <TABLE cellSpacing=0 cellPadding=0 width=100% border=0>
  <TR>
    <TD height="40" class="result_content"><B>小提示</B>：你只需输入标题、内容中的关键字信息，就可以搜索到你想要的信息了！</TD>
  </TR>
  <TR>
    <TD height="80"><p class="result_content">　<IMG src="images/icon/icon_alert.gif" align="absmiddle"> 对不起！未找到和您的查询相匹配的内容，请您另选关键字搜索！</p></TD>
  </TR>
</TABLE>
   <%else
      if m_PageNo = ""  then m_PageNo =1
      if cint(m_PageNo) < 1 or cint(m_PageNo) > m_Page then m_PageNo = 1
      rs.AbsolutePage = m_PageNo
      rc = m_PageSize
      re = 1
	  m_Count = 0'另加
      Do while not rs.eof and rc>0
	  m_Count = m_Count +1'另加
	  if m_Count mod 2 then m_BgColor = "ffffff" else m_BgColor = "f9f9f9" '另加
        '---------------------------------
		'调用显示内容
        ShowContent()
        '---------------------------------
      rs.MoveNext
      re = re+1
      rc = rc-1
    Loop
	rs.Close
 End if	
 Sub ShowContent()
 %>
 <DIV id=divInfoList>
 <DIV class=Info><DIV class=InfoTitleLine>
 <a target="_blank" class=InfoTitle href="../Htmls/<%=rs("F_FilePath")%>">·<%=rs("F_Title")%></a>
<% if rs("F_IsPic") then Response.write "<font color=D669A5>[图]</font>"%></DIV>
<DIV 
class=ShopSummary>&nbsp;<%=left(LoseHtml(rs("F_Content")),200)%>...</DIV>
<DIV class=URLLink><a class=GreenLink target="_blank" href="<%=site_info(1)%>/Htmls/<%=rs("F_FilePath")%>"><%=site_info(1)%>/Htmls/<%=rs("F_FilePath")%></a></DIV></DIV></DIV>

            <%End Sub%>

	  <!-- 分页过程 -->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TR>
    <TD height=5></TD>
  </TR>
</TABLE>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TR>
    <TD height=35>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><% Call ShowPage(m_Parameter)'调用示分页过程%%></td>
  </tr>
</table>

<%
	SUB ShowPage(strParameter)
  if m_PageNo = ""  then m_PageNo =1
  if cint(m_PageNo) < 1 or cint(m_PageNo) > m_Page then m_PageNo = 1
%>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
          <TR>
          <TD align=center height=35 width="30%"> 页次：<span class="dark4"><%=m_PageNo%></span>/<span class="dark4"><%=m_Page%></span>页 每页<span class="dark4"><%=m_PageSize%></span>条记录 总数<span class="dark4"><%=m_RecordCount%></span>条</TD>
          <TD width="70%">
            
<%  If m_PageNo > 1 then  %>
            <a href='?Page=1&<%=strParameter%>'> <img alt='首页' src='images/arrow4.gif' border=0 width='11' height='11'></a>
            <% Else  %>
            <img alt='首页' src='images/arrow4-1.gif' border=0 width='11' height='11'>
            <%  End if 
  if m_PageNo > 1 then
  %>
            <a href='?PageNo=<%=m_PageNo-1%>&<%=strParameter%>' class="content5">上一页</a>
            <% else %>
            <span class="content">上一页</span>
            <% end if 

  dim m_PageNumber,m,n,i
  m_PageNumber = 4 '数字分页个数+1
  if m_PageNo-int(m_PageNumber/2) <= 1 then m = 1 else m = m_PageNo-int(m_PageNumber/2)
  if m+m_PageNumber > m_Page then 
    n = m_Page
    if m_Page-m_PageNumber <= 1 then m=1 else m = m_Page - m_PageNumber
  else
    n = m+m_PageNumber
  end if

  for i = m to n
    if pno = cint(m_PageNo) then
      response.write "&nbsp;span class='result_highlight'>"&i&"</span>"
    else
      response.write "&nbsp;<a class='td4' href='?PageNo="&i&"&"&strParameter&"'>["&i&"]</a>"
    end if
  next
  Response.Write "&nbsp"

  if int(m_PageNo) < int(m_Page) then
  %>
            <a href='?PageNo=<%=m_PageNo+1%>&<%=strParameter%>' class="content5">下一页</a>
            <% else %>
            <span class="content">下一页</span>
            <%  end if 
  if int(m_PageNo) < int(m_Page) then
  %>
            <a href='?PageNo=<%=m_Page%>&<%=strParameter%>'><img alt='末页' src='images/arrow2.gif' border=0 width='11' height='11'></a>
            <% else %>
            <img alt='末页' src='images/arrow2-1.gif' border=0 width='11' height='11'>
            <%  end if	%>
            </SPAN></TD>
	  </TR>
       </TABLE>
  <% End Sub %>
    </TD>
  </TR>
</TABLE>
<%
if m_Keywords<>"" then 
		  'write search word 写入关键词
		  	set rst=server.createobject("adodb.recordset")
			sqlt="select * from search_word where f_class=1 and f_word='"&m_Keywords&"'"
			rst.open sqlt,conn,1,3
			if rst.eof then
			rst.addnew
			rst("f_word")=m_keywords
			rst("f_class")=1
			rst("F_update")=now()
			rst("f_ip")=Request.ServerVariables("REMOTE_ADDR") 
			rst.update
			else
			rst("f_hits")=rst("f_hits")+1   '搜索率
			rst("F_update")=now()
			rst("f_ip")=Request.ServerVariables("REMOTE_ADDR") 
			rst.update
			end if
			rst.close
			
%>


      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="result_table">
        <tr> 
          <td width="15%" align="center" class="content1">相关搜索：</td>
          <td width="85%" height="40">
	    <table width="100%" border="0" cellspacing="3" cellpadding="3">
              <tr align="center"> 
			  <% 			
			sqlt="select top 10 * from search_word where f_class=1"
				     if m_Keywords<>"" then	
					 	     idwords=split(m_Keywords," ")				 
					 sqlt=sqlt&" and ("
					  for i = 0 to ubound(idwords)					  
					   if idwords(i)<>"" then 
					   if i>0 then sqlt=sqlt&" or "
					  sqlt=sqlt&" f_word like  '%" & idwords(i) & "%'"
					   end if
					  next
					 sqlt=sqlt&" ) "
					 end if
			
			sqlt=sqlt&" order by f_hits desc"
			rst.open sqlt,conn
			i=1
			do while not rst.eof
			%>
                <td><A href="?keywords=<%=server.urlencode(rst("f_word"))%>" class="result_related"><%=rst("f_word")%></a></td>
			<%
			if i mod 5=0 then response.write "</tr><tr align=center>"
			i=i+1
			rst.movenext
			loop
			rst.close
			set rst=nothing
			%>		
              </tr>
            </table>
	  </td>
        </tr>
      </table>

<% end if %>


<TABLE cellSpacing=3 cellPadding=3 width=100% border=0>
  <FORM name=form2 action=select.jsp method=get>
  <TR>
    <TD align=center width="15%" class="content1">继续搜索：</TD>
    <TD align=center>

      <TABLE cellSpacing=0 cellPadding=0 width=100% border=0>
	<TR>
	  <TD height="30">
	    <INPUT size=22 class="input2" value="<%=m_Keywords%>" name=KeyWords>
	    <INPUT style="FONT-SIZE: 14px; HEIGHT: 25px" type=submit value=" 搜索 " name=Submit>
	  </TD>
	</TR>
	<TR>
	  <TD height="30">
	    <INPUT type=radio CHECKED value=1 name=t> 网站网页
	    <INPUT type=radio value=2 name=t> 商家大全 
	    <INPUT type=radio value=3 name=t> 折扣商家
	    <INPUT type=radio value=4 name=t> 信息广场
	  		<INPUT type=radio value=5 name=t> 论坛搜索</TD>
	</TR>
      </TABLE>

    </TD>
  </TR>
  </FORM>
</TABLE>	
<!--#include file="include/bottom.inc"-->

</html>
