<!-- #include file="include/con_help.asp" -->
<!-- #include file="include/jk_pagecute.asp" -->
<!-- #include file="include/jk_page_cute.asp" -->
<%
'****************************************************
' Joekoe CMS 1.2 Free      Power by Joekoe.com
' Email: cms@joekoe.com , service@joekoe.com
' Web: http://www.joekoe.com , http://www.topv.com
' Copyright (C) 2004 Joekoe.com All Rights Reserved.
'****************************************************

dim nummer,nums,page,rssum,thepages,viewpage,pageurl,sqladd,keyword,sea_type,sea_name,topic,topic2,sql1,sql2,sql3,linkurl,keywords,tims
pageurl="?"
sqladd=""
topic=""
linkurl=""
keywords=""
sea_name="搜索"
nummer=dim_num(0)
nums=nummer
viewpage=1
thepages=0
index_url="search"
tit_fir=""
tit="站内搜索"

call web_head(0,0,0,0,0)
'----------------------------左边 开始----------------------------
call left_help()
call left_action()
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
%>
<table border=0 cellspacing=0 cellpadding=0 width='100%'>
<tr><td align=center height=30><%call web_search()%></td></tr>
</table>
<%

call sea_types()
call sql_add()
if sqladd="" then
  call search_error()
else
  call search_main()
end if

response.write vbcrlf&ukong
'----------------------------中间 结束----------------------------
call web_end(0,0)

sub search_error()
%>
<table border=0 width='96%'>
<tr><td height=280 align=center>
  <table border=0>
  <tr><td colspan=2 height=30>您可能没有填写“搜索关键字”，请查看以下帮助说明：</td></tr>
  <tr><td width=10></td><td><%response.write img_skin("m_help2")%>在搜索时必须填写“搜索关键字”；</td></tr>
  <tr><td></td><td><%response.write img_skin("m_help2")%>如要搜索多个关键字请用<font class=red>空格</font>将多个关键字隔开，如：<font class=blue>V6&nbsp;插件</font>；</td></tr>
  <tr><td></td><td><%response.write img_skin("m_help2")%>“关键字”中不能含有单引号（'）；</td></tr>
  <tr><td></td><td><%response.write img_skin("m_help2")%>“关键字”中含有的加号（+）将被视为空格处理；</td></tr>
  <tr><td></td><td><%response.write img_skin("m_help2")%>“快速搜索”只在：新闻、文栏、下载里有效；</td></tr>
  <tr><td></td><td><%response.write img_skin("m_help2")%>祝您在使用本站的“站内搜索”时轻松愉快。</td></tr>
  </table>
</td></tr>
</table>
<%
end sub

sub search_main()
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td height=1 colspan=4 background='images/bg_dian.gif'></td></tr>
<tr align=center valign=bottom>
<td class=td0 width='6%'>序号</td>
<td class=td0 width='94%'>相关内容（您查询的关键字是：<%response.write keywords%>每页 <font class=red><%response.write nummer%></font> 条 <%response.write sea_name%> 查询结果）</td>
</tr>
<%
  tims=timer()
  sql=sql3&sqladd
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  call format_pagecute()
  sql=sql1&sqladd&sql2
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  if int(viewpage)>1 then rs.move (viewpage-1)*nummer
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
  for i=1 to nums
%>
<tr class=bg_td>
<td align=center class=tims><%response.write (viewpage-1)*nummer+i%></td>
<td><a href='<%
    response.write linkurl&rs(0)
    if sea_type="forum" then response.write "&forum_id="&rs(4)
%>' target=_blank><%response.write joekoe_cms.code_html(rs(1),1,0)%></a>&nbsp;<font class=tims><%response.write joekoe_cms.time_type(rs(3),3)%></font>&nbsp;
<%
    if sea_type="shop_product" then 
%>
<font class=blue><% response.write rs(2) %></font>&nbsp;<font class=red>元</font>
<%    
    else
      response.write format_user_name(rs(2),1,"blue")
    end if
%>
</td>
</tr>
<%
    rs.movenext
  next
  rs.close
%>
<tr><td colspan=2 class=bg_tds>
  <table border=0 width='100%' cellspacing=0 cellpadding=0>
  <tr>
  <td>共&nbsp;<font class=red><%response.write rssum%></font>&nbsp;条结果&nbsp;
页次：<font class=red><%response.write viewpage%></font>/<font class=red><%response.write thepages%></font>&nbsp;
分页：<%response.write jk_pagecute(nummer,thepages,viewpage,pageurl,3,"#ff0000")%></td>
  <td align=right><font class=gray>查询用时：<font class=red2><% response.write FormatNumber((timer()-tims)*1000,3) %></font> 毫秒</font></td>
  </tr>
  </table>
</td></tr>
<tr><td height=1 colspan=2 background='images/bg_dian.gif'></td></tr>
</table>
<%
end sub

sub sql_add()
  dim ddim,dnum,i
  keyword=joekoe_cms.code_form(request.querystring("keyword"))
  if len(keyword)<1 or len(topic)<1 then sqladd="":exit sub
  keyword=replace(keyword,"+"," ")
  pageurl=pageurl&"keyword="&server.urlencode(keyword)&"&"
  ddim=split(keyword," ")
  dnum=ubound(ddim)
  for i=0 to dnum
    keywords=keywords&"<font class=red2><b>"&ddim(i)&"</b></font>&nbsp;&nbsp;"
    sqladd=sqladd&" and "&topic2&" like '%"&ddim(i)&"%'"
  next
  erase ddim
  if sea_type="forum" and sqladd<>"" then
    sqladd=right(sqladd,len(sqladd)-4)
  end if
end sub

sub sea_types()
  dim celerity
  celerity=trim(request.querystring("celerity"))
  sea_type=trim(request.querystring("sea_type"))
  select case sea_type
  case "news","article"
    topic="topic"
    topic2=topic
    if celerity="yes" then topic2="keyes"
    linkurl=sea_type&"_view.asp?id="
    sea_name="新闻"
    if sea_type="article" then sea_name="文栏"
    sql1="select id,"&topic&",username,tim from "&sea_type&" where hidden=1"
    sql2=" order by id desc"
    sql3="select count(id) from "&sea_type&" where hidden=1"
  case "down"
    topic="name"
    topic2=topic
    if celerity="yes" then topic2="keyes"
    linkurl=sea_type&"_view.asp?id="
    sea_name="软件"
    sql1="select id,"&topic&",username,tim from "&sea_type&" where hidden=1"
    sql2=" order by id desc"
    sql3="select count(id) from "&sea_type&" where hidden=1"
  case "website"
    topic="name"
    topic2=topic
    linkurl=sea_type&".asp?action=view&id="
    sea_name="网站"
    sql1="select id,"&topic&",username,tim from "&sea_type&" where hidden=1"
    sql2=" order by id desc"
    sql3="select count(id) from "&sea_type&" where hidden=1"
  case "paste","flash"
    topic="name"
    topic2=topic
    linkurl="gallery_view.asp?types="&sea_type&"&id="
    sea_name="图片"
    if sea_type="flash" then sea_name="Flash"
    sql1="select id,"&topic&",username,tim from gallery where hidden=1 and types='"&sea_type&"'"
    sql2=" order by id desc"
    sql3="select count(id) from gallery where hidden=1 and types='"&sea_type&"'"
  case "shop_product"
    topic="name"
    topic2=topic
    linkurl="shop_view.asp?id="
    sea_name="商品"
    sql1="select id,"&topic&",price,tim from "&sea_type&" where hidden=1"
    sql2=" order by id desc"
    sql3="select count(id) from "&sea_type&" where hidden=1"
  case else
    sea_type="forum"
    topic="topic":topic2=topic
    linkurl="forum_view.asp?view_id="
    sea_name="论坛"
    sql1="select id,"&topic&",username,tim,forum_id from bbs_topic where"
    sql2=" order by id desc"
    sql3="select count(id) from bbs_topic where"
  end select
  pageurl=pageurl&"sea_type="&sea_type&"&"
end sub

'****************************************************
' Joekoe CMS 1.2 Free      Power by Joekoe.com
' Email: cms@joekoe.com , service@joekoe.com
' Web: http://www.joekoe.com , http://www.topv.com
' Copyright (C) 2004 Joekoe.com All Rights Reserved.
'****************************************************
%>