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

📄 search.asp

📁 asp构建网站bbs.采用B/S架构
💻 ASP
字号:
<!--#include file="up.asp"-->
<%
if lgname="" then 
noyes="操作失败"
mes="<p style='margin:4'><br>·您没有在本论坛搜索的权限,请<a href=login.asp>登陆</a>或和管理员联系<br>&nbsp;"
%>
<!--#include file="mes.asp"-->
<!--#include file="down.asp"-->
<%response.end
end if
action=request.querystring("action")
key=Replace(request.querystring("key"),"'","")
t1="<div align=center><center> <table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='98%' height='24'><tr><td width='180' background='pic/"&sp&"3.gif'>&nbsp;<img border='0' src='pic/fl.gif'> <font color='#FFFFFF'><b>"
t2="</b></font></td></tr></table></center></div><div align=center><center><table border=1 cellpadding=0 cellspacing=0 style='border-collapse: collapse' bordercolor="&c1&" width=98% >"
d1="<tr><td width=100% ><P style='MARGIN: 15px'>"
d2="</td></tr></table></center></div>"
response.write"<style>TABLE {BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 1px; }TD {BORDER-RIGHT: 0px; BORDER-TOP: 0px;}</style>"
if key="" then action=""%>
<%if action="" then%><br>
<form method="GET"><%=t1%>论 坛 搜 索<%=t2%>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="<%=c1%>" width="98%">
  <tr>
    <td width="100%" height="24" align="center" colspan="2" background="pic/<%=sp%>1.gif">搜索选项:</td>
  </tr>
  <tr>
    <td width="39%" height="30" align="right">搜索关键字:</td>
    <td width="61%">&nbsp;<input type="text" name="key" size="52"></td>
  </tr>
  <tr>
    <td width="39%" height="30" align="right">搜索类型:
    
    </td>
    <td width="61%">&nbsp;<input type="radio" value="1" checked name="stype">按帖子作者 
    <input type="radio" name="stype" value="2">按帖子主题 <input type="radio" name="stype" value="3">两者均搜</td>
  </tr>
  <tr>
    <td width="39%" height="30" align="right">搜索日期范围: </td>
    <td width="61%">&nbsp;<select size="1" name="riqi" style="font-size: 9pt">
    <option selected value="all">所有日期</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></td>
  </tr>
  <tr>
    <td width="39%" height="30" align="right">搜索数据表范围:</td>
    <td width="61%">
<%
alltb=alltable
atb=split(alltb,"|")
tnum=ubound(atb)
set rs=nothing
%>
    &nbsp;<select size="1" name="table" style="font-size: 9pt">
<%for i=0 to tnum%>
<option <%if int(autotable)=int(atb(i)) then%>selected<%end if%> value=<%=int(atb(i))%>>数据表 <%=atb(i)%></option><%next%>
</select></td>
  </tr>
  <tr>
    <td width="39%" height="30" align="right">搜索的论坛:</td>
    <td width="61%">&nbsp;<select size="1" name="bbs" style="font-size: 9pt">
    <option value="0">所有论坛</option>
    <%set rs=myconn.execute("select*from bdinfo where key<>'0'")
do while not rs.eof
response.write"<option value="&rs("bn")&">"&rs("bdname")&"</option>"
rs.movenext
loop
rs.close
set rs=nothing
%>
    </select></td>
  </tr>
  <tr>
    <td width="100%" height="40" align="center" colspan="2">
    <input type="submit" value=" 开 始 搜 索 "><input type="hidden" value="topic" name="action"></td>
    </tr>
</table><%=d2%></form><%end if%>
<%
if action="topic" then%><%
stype=int(Replace(request.querystring("stype"),"'",""))
riqi=Replace(request.querystring("riqi"),"'","")
table=Replace(request.querystring("table"),"'","")
if not isnumeric(table) then response.end
table=int(table)
if table=0 or table="" then table=autotable
bbs=int(Replace(request.querystring("bbs"),"'",""))
dim rs
dim sql
set rs = server.createobject("adodb.recordset")
href1="<a href=?topage=1&action="&action&"&key="&key&"&stype="&stype&"&table="&table&"&bbs="&bbs&"&riqi="&riqi&">"

sql1="select * from bbstl where "

if stype=1 then
sql=sql&"name='"&key&"' "
end if
if stype=2 then
sql=sql&"zhuti like '%"&key&"%' "
end if
if stype=3 then
sql=sql&"zhuti like '%"&key&"%' or name='"&key&"' "
end if
if riqi<>"all" then
if not isnumeric(riqi) then response.end
riqi=int(riqi)
sql=sql&"and riqi>now+"&timeset/24&"-"&riqi&" "
end if
if bbs<>0 then
sql=sql&"and bd="&bbs&" "
end if
sql=sql&"and totable="&table&""

sql1=sql1&sql&" order by orders desc"

csql="select count(id) from bbstl where "&sql
count=myconn.execute(csql)(0)
pagesetup=25
rs.Open sql1,myConn,1
%>
<%if rs.eof then%><br>
<%=t1%>论坛搜索<%=t2&d1%><p style="margin: 4">&nbsp;关键字 <%=kbbs(key)%> 找不到任何结果!<br>&nbsp; <%=d2%>
<%response.end
end if%>
<%
If Count/pagesetup > (Count\pagesetup) then
TotalPage=(Count\pagesetup)+1
else TotalPage=(Count\pagesetup)
End If
PageCount= 0
RS.MoveFirst
if 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
%><br>
<div align=center><center>
<table background="pic/<%=sp%>1.gif" border=1 bordercolor=<%=c1%> cellpadding=0 cellspacing=0 style="border-collapse:collapse; border-left-width:1px; border-right-width:1px; border-top-width:1px" width="98%" id=AutoNumber5>
<tr>
  <td width="89%" colspan="6" height="25" style="border-style: solid; border-width: 1">&nbsp;<b><font color="#FFFFFF"><img border="0" src="pic/fl.gif"> </font></b>关键字 <font color="#FF0000"><%=kbbs(key)%></font> 共搜索到 <b><%=count%></b> 个结果</td>
  </tr>
<tr>
  <td width=4% align=center background="pic/<%=sp%>3.gif" height="27">
  <b><font color="#FFFFFF">状态</font></b></td>
  <td width=42% align=center background="pic/<%=sp%>3.gif">
  <b><font color="#FFFFFF">主 题 ( 点小图标在新窗口浏览 )</font></b></td>
<td width=9% align=center background="pic/<%=sp%>3.gif"><b><font color="#FFFFFF">作 者</font></b></td>
  <td width=9% align=center background="pic/<%=sp%>3.gif">
  <b><font color="#FFFFFF">回复/人气</font></b></td>
<td width=16% align=center background="pic/<%=sp%>3.gif">
<b><font color="#FFFFFF">最后更新时间</font></b></td>
  <td width=9% align=center background="pic/<%=sp%>3.gif">
  <b><font color="#FFFFFF">最后回复</font></b></td></tr></table></center></div>
<%
i=1
do while not rs.eof
rrzz=kbbs(rs("zhuti"))
lastre=kbbs(rs("lastre"))
lbs=split(lastre,"|?|")
zui=""&lbs(0)&""
tltl="最后更新:"&lbs(1)&""
bno1=rs("bnum")
fface=rs("face")
if rs("type")=1 then fface="jing"
response.write"<div align=center><center><table width='98%' border=1 cellpadding=0 cellspacing=0 style='TABLE-LAYOUT: fixed; WORD-BREAK: break-all;border-collapse:collapse; border-left-width:1px; border-right-width:1px; border-top-width:1px' bordercolor="&c1&"  id=AutoNumber5><tr><td width=4%  bgcolor="&c2&" height=23 align=center><a target=_blank href=show.asp?id="&rs("id")&"&bd="&rs("bd")&"&totable="&rs("totable")&"&stype="&stype&"&bbs="&bbs&"&riqi="&riqi&"><img border=0 src=face/"&fface&".gif alt='在新窗口浏览此帖'></a></td><td width=42% height=27 align=left onmouseover=javascript:this.bgColor='"&c2&"' onmouseout=javascript:this.bgColor=''>&nbsp;<a  target=_self href=show.asp?id="&rs("id")&"&bd="&rs("bd")&"&totable="&rs("totable")&"&stype="&stype&"&bbs="&bbs&"&riqi="&riqi&" title="&LeftTrue(tltl,60)&">"&LeftTrue(rrzz,44)&"</a>"
if bno1>10 then
response.write"<img align=absmiddle border=0 src=pic/hot.gif>"
end if
response.write"</td><td width=9% height=23 align=center bgcolor="&c2&" ><a href='userinfo.asp?name="&kbbs(rs("name"))&"' title='查看 "&kbbs(rs("name"))&" 的资料'>"&kbbs(rs("name"))&"</a></td><td width=9% height=23 align=center>"&bno1&"/"&rs("hits")&"</td><td width=16% height=23 align=center>"&rs("orders")&"</td><td width=9% height=23 align=center bgcolor="&c2&" >"&zui&"</td></tr></table></center></div>"
i=i+1
if i>pagesetup then exit do
rs.movenext
loop
rs.Close
%><div align="center">
    <center>
<TABLE bgcolor=<%=c1%> borderColor=<%=c1%> cellSpacing=0 cellPadding=0 width="98%" border=1 style="border-collapse: collapse; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px">
<TBODY>
<TR height=25>
<TD height=2>
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0 background="pic/<%=sp%>3.gif" style="border-collapse: collapse; border-left-width:0; border-top-width:0; border-bottom-width:0">
<TBODY>
<TR>
<TD><b><font color="#FFFFFF">&nbsp;<img border="0" src="pic/fl.gif"> 共搜索到结果</font><font color="#00FFFF"> <%=TotalPage%> </font><font color="#FFFFFF">页,<font color="#00FFFF"> <%=count%> </font>个话题,每页有<font color="#00FFFF"> <%=pagesetup%> </font> 张贴子 >> [
<%
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 ""&href1&"<font color=yellow>1</font></a> ... "
end if

for i=ii to iii
If i<>PageCount then
href2="<a href=?topage="& i &"&action="&action&"&key="&key&"&stype="&stype&"&table="&table&"&bbs="&bbs&"&riqi="&riqi&">"
href3="<a href=?topage="&TotalPage&"&action="&action&"&key="&key&"&stype="&stype&"&table="&table&"&bbs="&bbs&"&riqi="&riqi&">"
Response.Write ""&href2&"<font color=yellow>" & i & "</font></a> "
else
Response.Write " <font color=red><b>"&i&"</b></font> "
end if
next

if TotalPage > PageCount+5 then
Response.Write " ... "&href3&"<font color=yellow>"&TotalPage&"</font></a>"
end if
%> ]</font></b></TD>
<form name=form method="POST" action=javascript:Check()>
<TD height=2 align="right"><font color="#FFFFFF">页码:<input style=FONT-SIZE:9pt maxLength="6" size="6" name="topage" value="<%=PageCount%>">
<input style=FONT-SIZE:9pt value="GO!" type="submit"></font></TD></form>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
</center>
  </div>

<%end if%>
<br><br><!--#include file="down.asp"-->
<script language='javascript'>function Check(){var Name=document.form.topage.value;document.location='search.asp?topage='+Name+'&action=<%=action%>&key=<%=key%>&stype=<%=stype%>&table=<%=table%>&bbs=<%=bbs%>&riqi=<%=riqi%>';}</script>

⌨️ 快捷键说明

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