📄 searchok.asp
字号:
<!-- #include file="setup.asp" -->
<%
if Request.Cookies("username")="" then
error("<li>您还还未<a href=login.asp>登陆</a>社区")
end if
if instr(Request.ServerVariables("http_referer"),""&Request.ServerVariables("server_name")&"") = 0 then
'error("<li>来源错误")
end if
search=Request("search")
forumid=Request("forumid")
content=Request("content")
searchxm=Request("searchxm")
searchxm2=Request("searchxm2")
searchxm2=replace(searchxm2,"@","&")
if content="" then
content=Request.Cookies("username")
end if
if forumid<>"" then
if isnumeric(""&forumid&"") = flase then:error("<li>非法操作"):end if
forumidor="forumid="&forumid&" and"
end if
if Request("search")="author" then
item=""&searchxm&"='"&content&"'"
elseif Request("search")="key" then
item=""&searchxm2&" like '%"&content&"%'"
end if
if request("TimeLimit")<>"" then
TimeLimit="and DateDiff('d',lasttime,now)<"&request("TimeLimit")&""
else
TimeLimit=""
end if
pagesetup=20 '设定每页的显示数量
count=conn.execute("Select count(id)from forum where deltopic<>1 and "&forumidor&" "&item&" "&TimeLimit&"")(0)
sql="select * from forum where deltopic<>1 and "&forumidor&" "&item&" "&TimeLimit&" order by lasttime Desc "
rs.Open sql,Conn
if Count=0 then
error("<li>对不起,没有找到您要查询的内容")
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
top
%>
<script>
var lastreadtree = 0;
function loadThreadFollow(ino){
var targetImg =eval("followImg" + ino);
var targetDiv =eval("follow" + ino);
if (targetDiv.style.display!='block'){
var nowtime = new Date();
if (nowtime - lastreadtree < 1 * 1000){alert("请不要同时读取多个帖子,以免造成论坛负荷过重!");return false;}
lastreadtree = nowtime;
targetDiv.style.display="block";
targetImg.src="images/minus.gif";
if (targetImg.loaded=="no"){document.frames["hiddenframe"].location.replace("loading.asp?id="+ino+"");}
}else{
targetDiv.style.display="none";
targetImg.src="images/plus.gif";
}
}
</script>
<IFRAME HEIGHT=0 WIDTH=0 NAME=hiddenframe></IFRAME>
<title>搜索结果</title>
<table width=97% align="center" border="0">
<tr>
<td vAlign="top" width="30%"><img src="images/logo.gif" border="0"></td>
<td vAlign="center" align="top"> <img src="images/closedfold.gif" border="0"> <a href=Default.asp?menu=listtitle><%=clubname%></a><br>
<img src="images/bar.gif" border="0"><img src="images/openfold.gif" border="0"> 搜索结果</td>
</tr>
</table>
<table width=97% align=center>
<tr>
<td width="100%" align="right">搜索关键字:<font color="#FF0000"><%=content%></font> 共找到了 <b><font color="#FF0000"><%=Count%></font></b> 篇相关帖子</td>
</tr>
</table>
<table cellSpacing="1" cellPadding="0" width=97% align="center" border="0" class=a2>
<tr height="25">
<td width="3%" class=a1> </td>
<td width="3%" class=a1> </td>
<td align="middle" height="24" class=a1 width="45%"> 主题</td>
<td align="middle" width="9%" height="24" class=a1> 作者</td>
<td align="middle" width="6%" height="24" class=a1> 字[回]</td>
<td align="middle" width="7%" height="24" class=a1> 点击</td>
<td width="27%" height="24" class=a1> 最后更新 最后回复</td>
</tr>
<%
i=0
Do While Not RS.EOF and i<pagesetup
i=i+1
if rs("toptopic")=1 then
reimage="<img src=images/f_top.gif>"
elseif rs("locktopic")=1 then
reimage="<img src=images/f_locked.gif>"
elseif rs("polltopic")<>"" then
reimage="<img src=images/f_poll.gif>"
elseif rs("replies")>15 or rs("views") > 150 then
reimage="<img src=images/f_hot.gif>"
elseif rs("replies")>0 then
reimage="<img src=images/f_new.gif>"
else
reimage="<img src=images/f_norm.gif>"
end if
if rs("goodtopic")=1 then
reimage2="<img src=images/topicgood.gif>"
elseif rs("username")=""&Request.Cookies("username")&"" then
reimage2="<img src=images/my.gif>"
else
reimage2=" "
end if
if rs("replies")>0 then
replies="<font color=red>["&rs("replies")&"]</font>"
else
replies=Len(rs("content"))
end if
newtopic=""
if rs("posttime")+1 > Now() then
newtopic="<img src=images/new.gif>"
end if
%>
<TR height=25>
<TD align=middle width="2%" class=a4 height=24><%=reimage%></TD>
<TD align=middle width="4%" class=a3><%=reimage2%> </TD>
<TD width="46%" align=left class=a4> <img loaded="no" src=images/plus.gif id="followImg<%=rs("id")%>" style="cursor:hand;" onclick="loadThreadFollow(<%=rs("id")%>)">
<img border=0 src=images/brow/<%=rs("icon")%>.gif>
<a onclick=min_yuzi() target=message href=ShowPost.asp?id=<%=rs("id")%>><%=rs("topic")%></a>
<SCRIPT>
if (<%=rs("replies")%> > 15) {
var topicpage=""
var tol=<%=rs("replies")%>/15+1;
for (var i=1; i < tol; i++) {
topicpage=topicpage+"<b><a onclick=min_yuzi() target=message href=ShowPost.asp?id=<%=rs("id")%>&topage="+ i +">"+ i +"</a></b> ";
}
document.write(" ( <img src=images/multipage.gif> "+topicpage+") ");
}</SCRIPT>
<%=newtopic%></TD>
<TD align=middle width=9% class=a3><a href=Profile.asp?username=<%=rs("username")%>><%=rs("username")%> </TD>
<TD align=middle width=5% class=a4><%=replies%> </TD>
<TD align=middle width=4% class=a3><%=rs("views")%> </TD>
<TD align=left width=30% class=a4> <%=rs("lasttime")%> | <a href=Profile.asp?username=<%=rs("lastname")%>><%=rs("lastname")%></a></TD>
</TR>
<TR height=25 style="display:none" id="follow<%=rs("id")%>">
<TD width="2%" class=a4> </TD>
<TD width="4%" class=a3> </TD>
<TD width="94%" align=left class=a4 id="followTd<%=rs("id")%>" colspan=5>
<div onclick="loadThreadFollow(<%=rs("id")%>)">
<table width=100% cellpadding=10><tr><td width=100%>
Loading...
</td></tr></table>
</div>
</TD>
</TR>
<%
RS.MoveNext
loop
RS.Close
%>
</TABLE>
<TABLE cellSpacing=0 cellPadding=1 width=97% align=center border=0>
<TBODY>
<TR height=25>
<TD width="100%" height=2>
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
<TBODY>
<TR>
<TD height=2><b> 本论坛共有
<font color="#990000"><%=TotalPage%></font> 页 [
<%
TimeLimit=Request("TimeLimit")
searchxm2=replace(searchxm2,"&","@")
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&forumid="&forumid&"&search="&search&"&searchxm="&searchxm&"&searchxm2="&searchxm2&"&content="&content&"&TimeLimit="&TimeLimit&"'>1</a> ... "
end if
for i=ii to iii
If i<>PageCount then
Response.Write " <a href='?topage="& i &"&forumid="&forumid&"&search="&search&"&searchxm="&searchxm&"&searchxm2="&searchxm2&"&content="&content&"&TimeLimit="&TimeLimit&"'>" & i & "</a> "
else
Response.Write " <font color=#000000><b>"&i&"</b></font> "
end if
next
if TotalPage > PageCount+5 then
Response.Write " ... <a href='?topage="&TotalPage&"&forumid="&forumid&"&search="&search&"&searchxm="&searchxm&"&searchxm2="&searchxm2&"&content="&content&"&TimeLimit="&TimeLimit&"'>"&TotalPage&"</a>"
end if
%>
]</b></TD>
<form name="form" action="searchok.asp?forumid=<%=forumid%>&search=key&searchxm2=topic" method="post">
<td height="2" align="right">
快速搜索:<input name="content" style="font-family: Tahoma,Verdana,宋体; font-size: 12px; line-height: 15px" size="20"> <input type="submit" value="搜索" name="submit" style="font-family: Tahoma,Verdana,宋体; font-size: 12px; line-height: 15px"> </td>
</form>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<br>
<center>
<p></p>
<div align="center">
<center>
<table cellSpacing="4" cellPadding="0" width="651" border="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td noWrap width="200">
<img alt src="images/f_new.gif" border="0"> 打开主题 (有回复的主题)</td>
<td noWrap width="100">
<img alt src="images/f_hot.gif" border="0"> 热门主题 </td>
<td noWrap width="100">
<img alt src="images/f_locked.gif" border="0"> 锁定主题</td>
<td noWrap width="150">
<img src="images/topicgood.gif">
精华主题</td>
</tr>
<tr>
<td noWrap width="200">
<img alt src="images/f_norm.gif" border="0"> 打开主题 (没有回复的主题)</td>
<td noWrap width="100">
<img alt src="images/f_poll.gif" border="0"> 投票主题</td>
<td noWrap width="100">
<img alt src="images/f_top.gif" border="0"> 置顶主题</td>
<td noWrap width="150">
<img src="images/my.gif">
自己发表的主题</td>
</tr>
</table>
</center>
</div>
<%
htmlend
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -