📄 search.asp
字号:
<% Option Explicit %>
<%response.buffer=true%>
<!--#include file="Inc_common.asp"-->
<!--#include file="Ubb.asp"-->
<%
'**************************************
'** Search.asp
'**
'** 文件说明:搜索页面
'** 修改日期:2004-9-22
'** 作者:Howlion
'** Email:howlion@163.com
'**************************************
dim key
key=filter(Trim(request("key")))
dim currentpage,page_count,Pcount
dim totalrec,endpage
if request("page")="" then
currentPage=1
else
if (not isnumeric(request("page"))) then
response.write "<br><p align='center'><FONT SIZE='3' COLOR='red'>非法的页面参数!</FONT>"
Response.End
end if
currentPage=cint(request("page"))
end if
dim mainpic
mainpic="page_search.gif"
Select Case request("act")
case "fillform"
call fillform()
case else
call main()
end Select
sub fillform()
pagename="搜索留言"
call pageinfo()
call skin1()
'---------------以下显示页面主体--------
%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="390"><tr><td width='100%'><p align="center">请输入要搜索的内容:<br><br><form action="search.asp" method="POST"><input type='text' name='key' size='20'> <input type='submit' value='搜索'></form>搜索范围将包括:留言者的称呼、留言标题、正文以及回复。</td></tr></table>
<%
'--------------页面主题显示结束--------
call skin2()
end sub
sub main()
%>
<SCRIPT language=JavaScript>
<!--
function go(src,q)
{
var ret;
ret = confirm(q);
if(ret!=false)window.location=src;
}
var flag=false;
function openwindow(url, width, height){var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=1,menubar=0,status=yes');}
-->
</script>
<%
pagename="搜索结果"
call pageinfo()
call skin1()
'---------------以下显示页面主体--------
if key="" then
dim errinfo
errinfo="请输入想要搜索的内容。"
error(errinfo)
call skin2()
exit sub
end if
%>
<SCRIPT language=JavaScript>
<!--
function go(src,q)
{
var ret;
ret = confirm(q);
if(ret!=false)window.location=src;
}
var flag=false;
function openwin(url, width, height){var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=1,menubar=0,status=yes');}
-->
</script>
<%
if session("login")="true" then
sql = "Select * from topic where (usertitle like '%"&key&"%' or usercontent like '%"&key&"%' or username like '%"&key&"%' or recontent like '%"&key&"%') order by usertime desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
else
sql = "Select * from topic where checked=1 and whisper=0 and (usertitle like '%"&key&"%' or usercontent like '%"&key&"%' or username like '%"&key&"%' or recontent like '%"&key&"%') order by usertime desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
end if
if rs.eof or rs.bof then
errinfo="未找到相关的留言,请简化关键词后再搜索。"
error(errinfo)
set rs=nothing
call skin2()
exit sub
end if
rs.PageSize = perpage
rs.AbsolutePage=currentpage
page_count=0
totalrec=rs.recordcount
response.write "<table width='75%' cellpadding=15 cellspacing=1 align=center><tr><td valign='top' align=center class=tablebody1>共找到 <b>"& totalrec &"</b> 条包含字符“<b>"&key&"</b>”的留言:</td></tr>"
call pages()
while (not rs.eof) and (not page_count = rs.PageSize)
%>
<div align="center">
<table border="0" cellpadding="5" cellspacing="1" style="border-collapse: collapse table-layout:fixed;word-break:break-all" bordercolor="#111111" width="95%" class="table1">
<tr>
<td width="180" rowspan="2" class="tablebody3" align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" colspan="2" align="center"><%if rs("top")=1 then%><img border="0" WIDTH="60" HEIGHT="60" src="images/bulletin.gif"><%else%><img border="0" WIDTH="90" HEIGHT="90" src="images/userfaces/<%=rs("userface")%>.gif" style='border: 1 solid #000000'><%end if%><br><br><%if rs("top")=1 then%><font color="<%=maincolor%>"><B>管理员公告</B></font><%else
dim username,username2
username=htmlencode(rs("username"))
username2=replace(username,key,"<b><font color=red>"&key&"</font></b>")
response.write username2 end if%></td>
</tr>
<tr>
<td width="100%" colspan="2" align="center"><IMG SRC="images/blank.gif" WIDTH="160" HEIGHT="20" BORDER="0"></td>
</tr>
<tr>
<td width="10%" align="right"><img border="0" src="images/homepage.gif"></td>
<td width="90%" align="left"><%if not rs("userurl")="" then%><a target="_blank" href="<%=htmlencode(rs("userurl"))%>" title="个人主页"><%=htmlencode(rs("userurl"))%></a><%else%><FONT COLOR="#7D7D7D">个人主页未填</FONT><%end if%></td>
</tr>
<tr>
<td width="10%" align="right"><img border="0" src="images/email.gif"></td>
<td width="90%" align="left"><%if not rs("usermail")="" then%><a href="mailto:<%=htmlencode(rs("usermail"))%>" title="电子邮件"><%=htmlencode(rs("usermail"))%></a><%else%><FONT COLOR="#7D7D7D">电子邮件未填</FONT><%end if%></td>
</tr>
<tr>
<td width="10%" align="right"><img border="0" src="images/qq.gif"></td>
<td width="90%" align="left"><%if not rs("userqq")="" then%><a target="_blank" href="http://friend.qq.com/cgi-bin/friend/user_show_info?ln=<%=rs("userqq")%>" title="QQ号码"><%=rs("userqq")%></a> <%else%><FONT COLOR="#7D7D7D">QQ号码未填</FONT><%end if%></td>
</tr>
</table>
</td>
<td width="100%" class="tablebody3">标题:<b><%dim usertitle,usertitle2
usertitle=htmlencode(rs("usertitle"))
usertitle2=replace(usertitle,key,"<font color=red>"&key&"</font>")
response.write usertitle2%></b>
<br>时间:<FONT face="Verdana" SIZE="1" COLOR="#434259"><%=rs("usertime")%></FONT></td>
</tr>
<tr>
<td class="tablebody3" width="100%" height="100" valign="top"><table border="0" cellpadding="5" cellspacing="5" style="border-collapse: collapse table-layout:fixed;word-break:break-all" bordercolor="#111111" width="100%"><tr><td width="100%">
<%dim usercontent,usercontent2
usercontent=ubbcode(rs("usercontent"))
usercontent2=replace(usercontent,key,"<b><font color=red>"&key&"</font></b>")
response.write usercontent2%></td></tr></table><%if rs("reply")=1 then%><p><table border="0" align="center" cellpadding="5" cellspacing="1" style="border-collapse: collapse table-layout:fixed;word-break:break-all" bordercolor="#111111" width="95%" class="table1"><tr><td width="100%" class="tablebody1"><FONT COLOR="<%=maincolor%>">管理员回复:<br><FONT SIZE="1" face="Verdana"><%=rs("retime")%></FONT> <br>----------------------------------------------------------<br>
<%dim recontent,recontent2
recontent=ubbcode(rs("recontent"))
recontent2=replace(recontent,key,"<b><font color=red>"&key&"</font></b>")
response.write recontent2%></FONT></p></td></tr></table><%end if%>
</td>
</tr>
<%if session("login")="true" then%><tr><td class="tablebody3" colspan="2" width="17%" align="right"><%if rs("checked")=0 then%><a href='javascript:go("Admin.asp?act=checking&id=<%=rs("id")%>&key=<%=key%>&p=<%=Request.QueryString("page")%>","确定通过审核?")' title="通过审核"><FONT COLOR="red"><B>通过审核</B></FONT></a> <%end if%><a href='javascript:go("Del.asp?id=<%=rs("id")%>&key=<%=key%>&p=<%=Request.QueryString("page")%>","您确定要删除?")' title="删除该文件">删除</a> <%if rs("whisper")=1 then%><FONT COLOR="red"><B>悄悄话留言,无法回复</B></FONT><%else%><a href="JavaScript:openwindow('Reply.asp?id=<%=rs("id")%>',600,500)">回复/编辑回复</a><%end if%> 留言IP:<%=rs("ip")%></td></tr><%end if%>
</table>
</div><p>
<%
page_count = page_count + 1
rs.movenext
wend
call pages()
rs.close
set rs=nothing
'--------------页面主题显示结束--------
call skin2()
end sub
sub pages()
dim ii,p,n
if totalrec mod perpage=0 then
n= totalrec \ perpage
else
n= totalrec \ perpage+1
end if
if currentpage-1 mod 10=0 then
p=(currentpage-1) \ 10
else
p=(currentpage-1) \ 10
end if
response.write "<table border=0 cellpadding=0 cellspacing=3 width='86%' align=center ><form method=post action=index_main.asp>"&_
"<tr>"&_
"<td valign=middle align=right>页次:<b>"& currentPage &"</b>/<b>"& n &"</b>页, 每页<b>"& rs.PageSize &"</b>条, 共<b>"& totalrec &"</b>条 "
if currentPage=1 then
response.write "<font face=webdings>9</font> "
else
response.write "<a href='?key="&key&"&page=1' title=首页><font face=webdings>9</font></a> "
end if
if p*10>0 then response.write "<a href='?key="&key&"&page="&Cstr(p*10)&"' title=上十页><font face=webdings>7</font></a> "
response.write "<b>"
for ii=p*10+1 to P*10+10
if ii=currentPage then
response.write "<font size=4>"+Cstr(ii)+"</font> "
else
response.write "<a href='?key="&key&"&page="&Cstr(ii)&"'>"+Cstr(ii)+"</a> "
end if
if ii=n then exit for
'p=p+1
next
response.write "</b>"
if ii<n then response.write "<a href='?key="&key&"&page="&Cstr(ii)&"' title=下十页><font face=webdings>8</font></a> "
if currentPage=n then
response.write "<font face=webdings>:</font> "
else
response.write "<a href='?key="&key&"&page="&Cstr(n)&"' title=尾页><font face=webdings>:</font></a> "
end if
response.write "</form></table>"
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -