<%
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 PerPage
					dim mcc
					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				
					set rs_c=server.createobject("adodb.recordset")
					sql_c="select * from info_ad where 1=1"
					mclassid=CheckStr(trim(request("classid")))
					 if mclassid<>"" then					 
					     if isnumeric(mclassid)=false then
                         Call Msgbox("对不起，搜索类别ID号发生错误！",1)
                         Response.end
                         end if
					   sql_c=sql_c&" and f_adclassid="&mclassid
					  
					 end if
					 m_area=CheckStr(trim(request("area")))
					 if m_area<>"" then
					 sql_c=sql_c&" and f_area='"&m_area&"'"
					 end if				
					
		if m_keywords<>"" then
	     idwords=split(m_keywords," ")
	      wordsql1=""
		  wordsql2=""
	     for i = 0 to ubound(idwords)
			 
		 if idwords(i)<>"" then 
		  if i>0 then
		 wordsql1 = wordsql1 +" and " 
		  wordsql2 = wordsql2 +" and " 		 
		 end if
     	 wordsql1 = wordsql1 +" f_title like  '%" & idwords(i) &"%'"       
     	 wordsql2 = wordsql2 +" f_content like  '%" & idwords(i) & "%'"	 
		 end if
	     next
		 wordsql=wordsql1&" or "&wordsql2	
	sql_c=sql_c +" and ( "&wordsql&" )"
	end if
				 
					sql_c=sql_c&" order by f_regtime desc"
					'response.write sql_c
					'response.end
					rs_c.open sql_c,conn,1,1
					'flag="尚未处理"
                    PerPage=20
				
                   '假如没有数据时
                 ' If rs_c.eof and rs_c.bof then
                  ' response.write "<p align='center'><font color='#ff0000'>还没任何新闻</font></p>"
                 ' response.end
                 ' End if
					'取得页数,并判断用户输入的是否数字类型的数据，如不是将以第一页显示
                    text="0123456789"
                    Rs_c.PageSize=PerPage
					
                    for i=1 to len(request("page"))
                    checkpage=instr(1,text,mid(request("page"),i,1))
                    if checkpage=0 then
                    exit for
                    end if
                    next

                  If checkpage<>0 then
                  If NOT IsEmpty(request("page")) Then
                  CurrentPage=Cint(request("page"))
                  If CurrentPage < 1 Then CurrentPage = 1
                  If CurrentPage > Rs_c.PageCount Then CurrentPage = Rs_c.PageCount
                  Else
                  CurrentPage= 1
                  End If
                 If not Rs_c.eof Then Rs_c.AbsolutePage = CurrentPage end if
                 Else
                 CurrentPage=1
                 End if					
				%>

<html>
<head>
<title>运城搜索 - 搜索"<%=m_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_search.inc"-->


<TABLE cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
  <TR>
    <TD>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0" class="td1">
	<TR>
    	  <TD width="9" height="28"></TD>
    	  <TD width="100">&nbsp;</TD>
    	  <TD width="1"><IMG src="images/icon/_1.gif"></TD>
    	  <TD width="75" class="td1"><a href="Search.jsp?keywords=<%=server.urlencode(m_keywords)%>" class="menu1">网站网页</a></TD>
    	  <TD width="1"><IMG src="images/icon/_1.gif"></TD>
    	  <TD width="75" class="td1"><a href="BizSearch.jsp?keywords=<%=server.urlencode(m_keywords)%>" class="menu1">商家大全</a></TD>
    	  <TD width="1"><IMG src="images/icon/_1.gif"></TD>
    	  <TD width="75" class="td1"><a href="CardSearch.jsp?keywords=<%=server.urlencode(m_keywords)%>" class="menu1">折扣商家</a></TD>
    	  <TD width="75" class="td2"><a href="InfoSearch.jsp?keywords=<%=server.urlencode(m_keywords)%>" class="menu">信息广场</a></TD>		      	  <TD width="1"><IMG src="images/icon/_1.gif"></TD>
    	  
    	  <TD width="75" class="td1"><a href="BBSSearch.jsp?keywords=<%=server.urlencode(m_keywords)%>" class="menu1">论坛搜索</a></TD>
    	  <TD class="td1">&nbsp;</TD>
	<TR>
      </TABLE>
    </TD>
  </TR>
  <TR>
    <TD height="60" class="tdbg1">
      <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
	<TR>
    	  <TD>&nbsp;</TD>
    	  <TD>

            <TABLE cellSpacing=0 cellPadding=0 width="500" border=0>
              <form name="form1" action="InfoSearch.jsp" method="get">
                <TBODY>
                  <TR>
                    <TD width="240" align="right"><INPUT name=keywords value="<%=m_keywords%>" class="input2" size=22></TD>
                    <TD align="center">
<select name="area" id="area">
                            <OPTION value="">所有区域</OPTION>
						   <%
             mSql="Select F_ID,F_Value From T_areaType where F_CityTypeID=22 order by f_grade"
			 Set rst = conn.Execute(mSql)
			 do while not rst.eof
          %>
          <option value="<%=rst("f_id")%>"><%=rst("f_value")%></option>
          <%
		  rst.movenext
		  loop
		  rst.close
		  set rst=nothing
		  %>                
                          </select>
						  <SELECT 
                  id=select6 name=Classid  dataType="Require">
                            <OPTION value="">所有类别</OPTION>
							 <% 
	 classsql="select * from info_adclass order by f_index desc"
	  'classsql="select f_id,f_value from mall_shopcategory order by f_index desc"
	  Set rsclass=Conn.Execute(classSql)	  
	  do while not rsclass.eof 	  
	  %>      
    <OPTION value=<%=rsclass("f_id")%>><%=rsclass("f_value")%></OPTION>
	<%
	rsclass.movenext
	loop
	rsclass.close
	set rsclass=nothing
	%>             
                          </SELECT>
                    </TD>
                    <TD><INPUT type="image" src="images/td/button_search.gif" width="68" height="24" name="Submit"></TD>
                  </TR>
                  </FORM>
                 </TABLE>

	  </TD>
	<TR>
      </TABLE>
    </TD>
  </TR>
  <TR>
    <TD height="1" bgcolor="#c0c0c0">
    </TD>
  </TR>
</TABLE>

	<% if not rs_c.eof then %>


<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;<%=m_Keywords%>&quot; <% end if %>相关信息</STRONG></SPAN> 共找到<span class="result_highlight"><%=Cstr(rs_c.RecordCount)%></span> 家(耗时 <% endtime=timer() %><%=FormatNumber((endtime-startime),3,-1)%>秒)
    </TD>
    <TD vAlign=bottom width="37%"><A href="http://www.yclife.cn/info/write_info.jsp" class="dark1" target=_blank>我要发布</A></TD>
  </TR>
</TABLE>

	<% end if %>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TR>
    <TD vAlign=top>

<%
if not rs_c.eof then
i=1
mcc=(CurrentPage*PerPage)-PerPage+1  '设定数值序号
do while not rs_c.eof
%>

      <TABLE cellSpacing=0 cellPadding=0 width="90%" border=0 style="border: #CCCCCC dotted; border-width: 1px 0px 0px 0px;" onMouseOver="className='td6';" onMouseOut="className='td5';">
        <TR>
          <TD colSpan=5 height=10></TD>
	</TR>
        <TR>
          <TD colSpan=5 height=25 style="padding-left:22px">
		<%
	  classsql="select f_id,f_value from info_adclass where f_id="&rs_c("F_adclassid")
	  Set rsclass=Conn.Execute(classSql)
	  if not rsclass.eof then
	  %><A class="result_url border" href="?ClassID=<%=rsclass("f_id")%>">【<%=left(rsclass("f_value"),2)%>】</A>
		<%
	  end if
	  rsclass.close
	  set rsclass=nothing
		%> <A class="result_title1" href="/info/ShowInfo.jsp?id=<%=rs_c("f_id")%>" target="_blank">
		<% if m_keywords<>"" then %>
                <%
				re_text=rs_c("f_title")
				for i = 0 to ubound(idwords)
				re_text=replace(re_text,idwords(i),"<span class='result_highlight'>"&idwords(i)&"</span>")
				next
				response.write re_text				
				%> 
                <% else %>
                <%=rs_c("f_title")%>
                <% end if %></A> <span class="result_content">发布时间：<span class="dark">[<%=datevalue(rs_c("f_regtime"))%>]</span></TD>
	</TR>
        <TR bgcolor="#f9f9f9" height=25>
          <TD width=24% class="result_content" style="padding-left:22px"><img src="images/icon/icon_002.gif" align="absmiddle"> 已　读：[<%=rs_c("f_hits")%>]</TD>
          <TD width=20% class="result_content"><img src="images/icon/icon_001.gif" align="absmiddle"> 回　复：
		<%
		  	set rst=server.createobject("adodb.recordset")
			sqlt="select count(*)as mccount from info_adcomment where f_adid="&rs_c("f_id")
			rst.open sqlt,conn
			if not rst.eof then
			commentcount=rst("mccount")
			else
			commentcount=0
			end if
			rst.close
			set rst=nothing
		%>
		  [<%=commentcount%>]</TD>
          <TD width=28% class="result_content"><img src="images/icon/icon_003.gif" align="absmiddle"> 有效期至：<span class="dark5">[<%=rs_c("f_update")%>]</span></TD>
          <TD width=28% colSpan=2 class="result_content"><img src="images/icon/icon_004.gif" align="absmiddle"> 
		<% if rs_c("f_username")<>"" then %> 
		  发布者： 			
		<%=rs_c("f_username")%>
		<% else %>
		  匿名发布
		<% end if %> 
	  </TD>
	</TR>
        <TR>
          <TD height=25 colSpan=5 style="padding-left:22px">
            <TABLE cellSpacing=0 cellPadding=0 width=100% border=0>
              <TR>
                <TD width=80 class="result_content">内　容：</TD>
                <TD vAlign=top width=100% rowSpan=2 class="result_content">
				<% if rs_c("f_content")<>"" then %> 
				<% if m_keywords<>"" then %> 
				<%
				re_text=left(ubbcode(rs_c("f_content"),0),150)
				for i = 0 to ubound(idwords)
				re_text=replace(left(ubbcode(rs_c("f_content"),0),150),idwords(i),"<span class='result_highlight'>"&idwords(i)&"</span>")
				next
				response.write re_text				
				%>
				 <% else %>
				  <%=left(ubbcode(rs_c("f_content"),0),150)%>
				  <% end if %>...
				  <% end if %>
               <A class="result_url" href="/info/ShowInfo.jsp?id=<%=rs_c("f_id")%>" target="_blank">[详细内容]</A> </TD>
              </TR>
              <TR>
                <TD>&nbsp;</TD>
	      </TR>
	    </TABLE>
          </TD>
	</TR>
        <TR>
          <TD colSpan=5 height=10></TD>
        </TR>
      </TABLE>

<%
if i >= Perpage then exit do
i=i+1
mcc=mcc+1
rs_c.movenext
loop

else
%>

<!-- include nothing -->

<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>


<%
end if

%>
      </TD>
      <TD vAlign=top align=middle width=220>

<!-- 右侧关键字广告区 -->
<TABLE width="95%" cellSpacing="0" cellPadding="0" border="0" class="table_border">
        <TR>
          <TD align=center background="images/bg/bg_td_title.jpg" height="32">关键字广告</TD>
        </TR>
      </TABLE>

                <%					
					
				    set rst=server.createobject("adodb.recordset")
					sql_c="SELECT  * FROM CityCard_League WHERE (ischecked=1)"
						
					  if m_keywords<>"" then					 
					 sql_c=sql_c&" and ("
					  for i = 0 to ubound(idwords)					 
					  if idwords(i)<>"" then 
					  if i>0 then sql_c=sql_c&" or "
					  sql_c=sql_c&" name like  '%" & idwords(i) & "%'"
					  end if
					  next
					 sql_c=sql_c&" ) "
					 end if
					 
					sql_c=sql_c&" order by grade desc ,tuijian desc"
					rst.open sql_c,conn,1,1
					'response.write sql_c
					'response.end
					'flag="尚未处理"
                    PerPage=12
				
                   '假如没有数据时
                 ' If rs_c.eof and rs_c.bof then
                  ' response.write "<p align='center'><font color='#ff0000'>还没任何新闻</font></p>"
                 ' response.end
                 ' End if
					'取得页数,并判断用户输入的是否数字类型的数据，如不是将以第一页显示
                    text="0123456789"
                    Rs_c.PageSize=PerPage
					m_pageno=request("page")
                    for i=1 to len(m_PageNo)
                    checkpage=instr(1,text,mid(m_PageNo,i,1))
                    if checkpage=0 then
                    exit for
                    end if
                    next

                  If checkpage<>0 then
                  If NOT IsEmpty(m_PageNo) Then
                  CurrentPage=Cint(m_PageNo)
                  If CurrentPage < 1 Then CurrentPage = 1
                  If CurrentPage > Rst.PageCount Then CurrentPage = Rst.PageCount
                  Else
                  CurrentPage= 1
                  End If
                 If not Rst.eof Then Rst.AbsolutePage = CurrentPage end if
                 Else
                 CurrentPage=1
                 End if					
		
if not rst.eof then
i=1
do while not rst.eof
%>

<!-- 右侧商家展示 -->

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

      <TABLE cellSpacing=2 cellPadding=2 width=95% border=0 class="result_table">
	<TR>
	  <TD><a target="_blank" class="result_title_right" href="<% if rst("template_id")<>"0" then %>/jubao/show.jsp?id=<%=rst("companyid")%><% else %>/jubao/show.jsp?id=<%=rst("companyid")%><% end if %>">
            	<% if m_Keywords<>"" then %>
                <%
				re_text=rst("name")
				for m = 0 to ubound(idwords)
				re_text=replace(re_text,idwords(m),"<span class='result_highlight'>"&idwords(m)&"</span>")
				next
				response.write re_text
				%> 
                <% else %>
                <%=rst("name")%> 
                <% end if %></A>
	  </TD>
	</TR>
	<TR>
	  <TD>地址：<%=rst("address")%></TD>
	</TR>
	<TR>
	  <TD>电话：<% =left(rst("tel"),20) %></TD>
	</TR>
	<TR>
	  <TD class="result_url">
	<% if rst("website")<>"" then %>
	<a target="_blank" class="result_url" href="http://<%=rst("website")%>"><%=rst("website")%></a>
	<% else %>
	<a class="result_url" target="_blank" href="<% if rst("template_id")<>"0" then %>/jubao/show.jsp?id=<%=rst("companyid")%><% else %>/jubao/show.jsp?id=<%=rst("companyid")%><% end if %>">
	<% if rst("template_id")<>"0" then %>/jubao/show.jsp?id=<%=rst("companyid")%>
	<% else %>/jubao/show.jsp?id=<%=rst("companyid")%>
	<% end if %>
	</a>
	<% end if %>
	  </TD>
        </TR>
      </TABLE>

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


                <%
if i >= Perpage then exit do
i=i+1
rst.movenext
loop
end if
rst.close

%>


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

      <!-- 窄告开始 -->


     </TD>
  </TR>
</TABLE>



<!-- 分页过程 -->

<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>
  <TBODY>
    <TD height=35>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <FORM action="?classid=<%=mclassID%>&keywords=<%=server.urlencode(m_keywords)%>&area=<%=m_area%>" name="formname" method=post>
        <TBODY>
        <TR>
          <TD background="" colSpan=3 height=1></TD></TR>
        <TR>
          <TD class=style1 align=middle  
            height=35>页次：<B><FONT color=#ff0000><%=CurrentPage%></FONT></B>/<B><FONT 
            color=#ff0000><%=Cstr(rs_c.pagecount)%></FONT></B>页 每页<B><FONT 
            color=#ff0000><%=PerPage%></FONT></B>条记录 总数<B><FONT 
            color=#ff0000><%=Cstr(rs_c.RecordCount)%></FONT></B>条</TD>
          <TD class=13font align=middle ><SPAN 
            class=Bfont>  <% If currentpage > 1 Then  %>
                        &nbsp;<a href='?classid=<%=mclassID%>&keywords=<%=server.urlencode(m_keywords)%>&area=<%=m_area%>&page=<%=cstr(1)%>'><img alt='首页' src='images/arrow4.gif' border=0 width='11' height='11'></a> 
                        &nbsp;<a href='?classid=<%=mclassID%>&keywords=<%=server.urlencode(m_keywords)%>&area=<%=m_area%>&page=<%=Cstr(currentpage-1)%>'><img alt='上一页' src='images/arrow3.gif' border=0 width='14' height='11'></a> 
                        &nbsp; 
                        <% Else  %>
                        &nbsp;<img alt='首页' src='images/arrow4-1.gif' border=0 width='11' height='11'> 
                        &nbsp;<span class="content">上一页</span>
                        <% end if %>
                        <%
			  if rs_c.pagecount>4 then
			  n_star=currentpage
			  n_end=currentpage+3
			  else
			  n_star=1
			  n_end=rs_c.pagecount			  
			  end if
			  %>
                        <% FOR n=n_star to n_end %>
                        <% if n>rs_c.pagecount then  exit for  end if%>
                        &nbsp;<a href='?classid=<%=mclassID%>&area=<%=m_area%>&keywords=<%=server.urlencode(m_keywords)%>&page=<%=n%>'><FONT color=#ff0000><B><%=n%></B></FONT></a> 
                        <%
					  next
					  %>
                        <% If currentpage < Rs_c.PageCount Then %>
                        &nbsp;<a href='?classid=<%=mclassID%>&area=<%=m_area%>&keywords=<%=server.urlencode(m_keywords)%>&page=<%=Cstr(currentPage+1)%>'><img alt='下一页' src='images/arrow1.gif' border=0 width='14' height='11'></a> 
                        &nbsp;<a href='?classid=<%=mclassID%>&area=<%=m_area%>&keywords=<%=server.urlencode(m_keywords)%>&page=<%=Cstr(Rs_c.PageCount)%>'><img alt='末页' src='images/arrow2.gif' border=0 width='11' height='11'></a> 
                        <% else %>
                        &nbsp;<span class="content">下一页</span>
                        &nbsp;<img alt='末页' src='images/arrow2-1.gif' border=0 width='11' height='11'>
                        <% end if %></SPAN> 
                       
            </TD>
        </TR>
      </TABLE>
    </TD>
  </TR>
</TABLE>

<%
if m_keywords<>"" then 
		  'write search word 写入关键词
		  	set rst=server.createobject("adodb.recordset")
			sqlt="select * from search_word where f_class=4 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")=4
			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=4 "
			       if m_keywords<>"" then					 
					 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
			rst.open sqlt,conn
			i=1
			do while not rst.eof
			%>
                <td class="F14"><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></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 value=1 name=t> 网站网页
	    <INPUT type=radio value=2 name=t> 商家大全 
	    <INPUT type=radio value=3 name=t> 折扣商家
	    <INPUT type=radio CHECKE value=4 name=t> 信息广场
		<INPUT type=radio value=5 name=t> 论坛搜索
		</TD>
	</TR>
      </TABLE>

    </TD>
  </TR>
  </FORM>
</TABLE>

<!--#include file="include/bottom.inc" -->
</BODY>
</HTML>
<% rs_c.close %>
