⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search.asp

📁 本程序蓝本为6kbbs 默认前台管理员的帐号是:woodcoal
💻 ASP
字号:
<!--#include file="up.asp"-->
<script>ctree('→ <a href=search.asp>论坛搜索</a>')</script>

<%if isnull(lguserid) or lguserid="" then
tl=""
mes="对不起,该功能只对会员开放。"
call sendinfo(tl,mes)
call down
response.end
end if
dim action,key,sql,thetime,searchtime,bbs,pagesetup,totalpage,Count,pagecount,topicinfo,retopic,reinfo,ii,iii
%>
<style type=text/css>
.c1{background-color: <%=c1%>}
.c2{background-color: <%=c2%>}
.c3{background-color: #ffffff}
.hf{background-image: url(<%=tbw%>);color:#ffffff; font-weight: bold;height=25}
</style>
<center><%=ttop%><table border="0" cellpadding="5" cellspacing="1" style="border-collapse: collapse" width="<%=tbw%>" class=c1>
  <tr><form method="GET" action="?">
    <td class=c2 height=40>
      <b>关键字:</b>
      <input type="text" name="key" size="40">
       <select size="1" name="searchtime" style="font-size: 9pt">
      <option selected value="0">所有日期</option>
      <option value="1">1天以来</option>
      <option value="2">2天以来</option>
      <option value="7">7天以来</option>
      <option value="15">15天以来</option>
      <option value="30">30天以来</option>
      </select>
       <select size="1" name="bbs" style="font-size: 9pt">
      <option value="0">所有论坛</option>
      <%set rs=conn.execute("select id,bdinfo from bdinfo where followid<>0 order by orders desc,id")
      do while not rs.eof
      response.write"<option value="&rs("id")&">"&split(rs("bdinfo"),"|")(0)&"</option>"
      rs.movenext
      loop
      rs.close
      set rs=nothing
      %></select>
       <input type="submit" value=" 搜 索 " name="B1"><input type="hidden" name="action" size="20" value="search">
    </td><%=tbottom%></form></center>
  </tr>
<%
key=Replace(request.querystring("key"),"'","")
key=Replace(key,"[","[[]")
key=Replace(key,"|","│")
if key="" then response.write"<tr><td class=c2><center>请输入要搜索的关键字。关键字必须大于2个字符,支持与关系搜索,如“娱乐 网站”。</td></tr></center></table>":call down:response.end

Dim N,TempKey,FullTextKey
If key<>"" then
	if instr("face",key) or instr("                                                                ",key) or len(key)<2 then
tl=""
mes="<b>搜索关键字太短,或者关键字含有非法字符。</b><br><a href='javascript:history.go(-1)'><img border=0 src=pic/re.gif align=absmiddle> 返回重新填写</a>"
call sendinfo(tl,mes)
call down
response.end
	else
		response.write"<center><tr><td class=c2>您搜索的是: <font color=red>"&key&"</font> ,以下是搜索结果:</td></tr></table></center>"
	end if
	TempKey = split(Key," ")
	FullTextKey = ""
	for N = 0 to ubound(TempKey)
		If TempKey(N)<>"" Then FullTextKey = FullTextKey&"topicinfo like '%"&TempKey(N)&"%' and "
	Next
	If Right(FullTextKey,5) = " and " Then FullTextKey = Left(FullTextKey,Len(FullTextKey) - 5)

searchtime=checknum(request.querystring("searchtime"))
bbs=checknum(request.querystring("bbs"))
sql="select*from topic where "&FullTextKey&" and type<>3"
if bbs>0 then sql=sql&"and bd="&bbs&" "
if searchtime>0 then sql=sql&"and edittime>now()+"&timeset&"/24-"&searchtime&""
sql=sql&" order by edittime desc"
response.write"<script language='javascript'>function Check(){var Name=document.form.topage.value;document.location='?action=search&bbs="&bbs&"&key="&key&"&searchtime="&searchtime&"&topage='+Name+'';}</script>"
set rs = server.createobject("adodb.recordset")
pagesetup=checknum(application(prefix&"topiclistpage"))
rs.Open sql,conn,1
TotalPage=0
Count=rs.recordcount
if rs.eof then response.write"<br><br><center>抱歉!没有找到您需要的结果!</center><br><br>":call down:response.end
if not rs.eof then
	response.write"<br><table align=center class=c1 border=0 cellpadding=0 cellspacing=0 style='border-collapse: collapse' width="&tbw&" bgcolor="&c1&" background="&tbg&" height=38><tr align=center class=hf><td width=5% >表情</td><td width=45% >主题 (点击表情在新窗口打开)</td><td width=10% >作者</td><td width=5% >回复</td><td width=5% >人气</td><td width=20% >最后更新时间</td><td width=10% >最后回复</td></tr>"
	If Count/pagesetup > (Count\pagesetup) then
		TotalPage=(Count\pagesetup)+1
	else
		TotalPage=(Count\pagesetup)
	End If
	pagecount= 0
	rs.moveFirst
	if Request.QueryString("ToPage")<>"" and isnumeric(Request.QueryString("ToPage")) then PageCount = cint(Request.QueryString("ToPage"))
	if PageCount <=0 then PageCount = 1
	if PageCount > TotalPage then PageCount = TotalPage
	rs.move (PageCount-1) * pagesetup
	i=1
	do while not rs.eof
	topicinfo=rs("topicinfo")
	topicinfo=split(topicinfo,"|")
	retopic=rs("retopic")
	if isnull(retopic) or retopic="" then
		reinfo="——"
		retopic="未有人回复。|——|0"
		retopic=split(retopic,"|")
	else
		retopic=split(retopic,"|")
		reinfo="<a href=userinfo.asp?userid="&retopic(2)&">"&kbbs(retopic(1))&"</a>"
	end if
	response.write"<tr height=28><td align=center class=c2><a target=_blank href='show.asp?bd="&rs("bd")&"&id="&rs("id")&"&totable="&rs("totable")&"' title='最后回复:"&kbbs(retopic(0))&"'><img border=0 src=images/face/"&topicinfo(0)&".gif></a></td><td class=c3 onMouseOver=this.style.backgroundColor='#F8F8F8' onMouseOut=this.style.backgroundColor=''>&nbsp;&nbsp;<a href='show.asp?bd="&rs("bd")&"&id="&rs("id")&"&totable="&rs("totable")&"' title='最后回复:"&kbbs(retopic(0))&"'>"&topicinfo(3)&" <font color="&replacecolor(kbbs(topicinfo(1)))&">"&lefttrue(kbbs(topicinfo(1)),40)&"</font></a></td><td align=center class=c2><a href=userinfo.asp?userid="&rs("userid")&">"&kbbs(topicinfo(2))&"</a></td><td align=center class=c3>"&rs("renum")&"</td><td class=c2 align=center>"&rs("hits")&"</td><td align=center class=c3>"&rs("edittime")&"</td><td align=center class=c2>"&reinfo&"</td></tr>"
	i=i+1
	if i>pagesetup then exit do
	rs.movenext
	loop
end if
rs.Close
set rs=nothing
response.write"</table><TABLE align='center' cellSpacing=0 cellPadding=0 width="&tbw&" bgcolor="&c1&"  border=0 class=tab1><TR height=25 class=c2><TD>&nbsp;&nbsp;<img border='0' src='pic/fl.gif'> 本版面共 <b>"&count&"</b> 帖,每页 <b>"&pagesetup&"</b> 帖,分 <b>"&TotalPage&"</b> 页: &nbsp; "

if PageCount=1 then
Response.Write " <font face=Webdings title=首页 color=888888>9</font> <font face=Webdings title=上页 color=888888>7</font> "
else
Response.Write " <a href=?topage=1&action=search&bbs="&bbs&"&key="&key&"&searchtime="&searchtime&"><font face=Webdings title=首页>9</font></a> <a href=?topage="&PageCount-1&"&action=search&bbs="&bbs&"&key="&key&"&searchtime="&searchtime&"><font face=Webdings title=上页>7</font></a> "
end if
ii=PageCount-5
iii=PageCount+5
if ii < 1 then
ii=1
end if
if iii > TotalPage then
iii=TotalPage
end if
if PageCount > 6 then
Response.Write "<a href=?topage=1&action=search&bbs="&bbs&"&key="&key&"&searchtime="&searchtime&">1</a> ... "
end if
for i=ii to iii
If i<>PageCount then
Response.Write "<a href=?topage="& i &"&action=search&bbs="&bbs&"&key="&key&"&searchtime="&searchtime&">" & i & "</a> "
else
Response.Write " <font color=red><b>"&i&"</b></font> "
end if
next
if TotalPage > PageCount+5 then
Response.Write " ... <a href=?topage="&TotalPage&"&action=search&bbs="&bbs&"&key="&key&"&searchtime="&searchtime&">"&TotalPage&"</a>"
end if
if PageCount=TotalPage then
Response.Write " <font face=Webdings title=下页 color=888888>8</font> <font face=Webdings title=尾页 color=888888>:</font> "
else
Response.Write " <a href=?topage="&PageCount+1&"&action=search&bbs="&bbs&"&key="&key&"&searchtime="&searchtime&"><font face=Webdings title=下页>8</font></a> <a href=?topage="&TotalPage&"&action=search&bbs="&bbs&"&key="&key&"&searchtime="&searchtime&"><font face=Webdings title=尾页>:</font></a> "
end if

response.write" </TD><form name=form method='POST' action=javascript:Check()><TD height=2 align='right'>页码:<input style=FONT-SIZE:9pt maxLength='6' size='6' name='topage' value='"&PageCount&"'><input style=FONT-SIZE:9pt value='GO!' type='submit'></TD></form></TR></TABLE><script>tbottom()</script>"

%>


<%End If
call down%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -