?? search.asp
字號(hào):
<!--#include file="inc_common.asp"-->
<!--#include file="UBB.asp"-->
<%
dim key
key=sql_filter(left(Trim(Request.QueryString("key")),15))
dim currentpage,page_count,Pcount
dim totalrec,endpage
if Request.QueryString("page")="" then
currentPage=1
else
if (not isnumeric(Request.QueryString("page"))) then
errinfo="<li>非法的頁面參數(shù)!</li>"
call showError()
end if
currentPage=cint(Request.QueryString("page"))
end if
pagename="搜索留言"
call bodySkin()
sub pageContent()
if Request.Form("key")="" and key="" then
fillForm()
else
searchResult()
end if
end sub
function fillForm()
%>
<div id="searchForm">
<form action="search.asp" method="post">
<input type="text" name="key" size="20"> <input type="submit" class="button" value="搜 索"><br />
<span class="noteText">搜索范圍將包括:留言者的稱呼、留言標(biāo)題、正文以及回復(fù)</span>
</form>
</div>
<%
end function
function searchResult()
if len(sql_filter(Trim(Request.Form("key")))) = 1 or len(key) = 1 then
errinfo="<li>關(guān)鍵字過短。</li>"
call showError()
else
if (not sql_filter(Trim(Request.Form("key")))="") and key="" then
Response.Redirect "?key="&Trim(Request.Form("key"))
Response.Flush
end if
end if
if login then
sql = "Select * from [topic] where (usertitle like '%"&key&"%' or usercontent like '%"&key&"%' or username like '%"&key&"%' or recontent like '%"&key&"%') order by top desc,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 top desc,usertime desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
end if
if rs.eof or rs.bof then
rs.close
set rs=nothing
errinfo="<li>沒有找到包含“"&back_filter(key)&"”的留言,請(qǐng)簡(jiǎn)化關(guān)鍵字后再搜索。</li>"
call showError()
end if
rs.PageSize = perpage
rs.AbsolutePage=currentpage
page_count=0
totalrec=rs.recordcount
if not totalrec mod perpage=0 then
if currentPage > (totalrec/perpage)+1 then response.redirect "?key="&key&"&page=" & Int((totalrec/perpage))+1
else
if currentPage > (totalrec/perpage) then response.redirect "?key="&key&"&page=" & Int((totalrec/perpage))
end if
call pages()
while (not rs.eof) and (not page_count = rs.PageSize)
dim username,userURL,usermail,userqq,usertitle,usertime,usercontent,recontent,retime
username = Boldkey(HTMLencode(rs("username")),key)
userURL = HTMLencode(rs("userURL"))
usermail = HTMLencode(rs("usermail"))
userqq = HTMLencode(rs("userqq"))
usertitle = Boldkey(HTMLencode(rs("usertitle")),key)
usertime = rs("usertime")
usercontent = Boldkey(UBBCode(rs("usercontent"),rs("top")),key)
recontent = Boldkey(UBBCode(rs("recontent"),1),key)
retime = rs("retime")
%>
<a id="<%=rs("id")%>">
<div class="msgArea">
<%if rs("whisper")="1" and (not login) then%>
<div class="msgArea-left">
<ul >
<li class="userFace"><img class="face-normal" src="<%=userfacesFolder%>/whisper.gif" alt="悄悄話" /></li>
</ul>
</div>
<div class="msgArea-right">
<div class="msgTitle">
<span class="msgTitle-whisper">悄悄話留言</span>
</div>
<div class="msgTime" ><%=usertime%></div>
<div class="msgContent">
<div class="msgContent-whisper">
此留言僅管理員可見。<br />
<%if rs("replycode")<>"" then%>
<%if rs("reply")=1 then
call viewreply(rs("id"))
else%>狀態(tài):未被回復(fù)。<%end if
else%>狀態(tài):無法被回復(fù)。<%end if%>
</div>
</div>
</div>
<%else%>
<div class="msgArea-left"> <!-- 頭像、稱呼 -->
<ul >
<li class="userFace"><%if rs("top")=1 then%><img class="face-bulletin" src="<%=userfacesFolder%>/bulletin.gif" alt="管理員" /><%else%><img class="face-normal" src="<%=userfacesFolder%>/<%=rs("userface")%>.gif" alt="<%=HTMLencode(rs("username"))%>" /><%end if%></li>
<li class="userName"><%if rs("top")=1 then%><span class="userName-istop">管理員</span><%else%><%=username%><%end if%></li>
</ul>
</div>
<div class="msgArea-right"> <!-- 標(biāo)題、時(shí)間、留言內(nèi)容、回復(fù) -->
<div class="msgTitle"><%if rs("top")=1 then%><span class="msgTitle-istop">公告:</span><%else%>標(biāo)題:<%end if%><h3><%=usertitle%></h3></div>
<div class="msgTime" ><%=usertime%></div>
<div class="userContact">
<%if not rs("userURL")="" then%><a target="_blank" href="<%=userURL%>"><img class="imgLink" src="<%=imagesFolder%>/homepage.gif" alt="訪問“<%=HTMLencode(rs("username"))%>”的網(wǎng)站" /></a>
<%else%>
<img class="imgLink" src="<%=imagesFolder%>/homepage_grey.gif" alt="" />
<%end if%>
<%if not rs("usermail")="" then%><a href="mailto:<%=usermail%>"><img class="imgLink" src="<%=imagesFolder%>/email.gif" alt="給“<%=HTMLencode(rs("username"))%>”發(fā)送電子郵件" /></a>
<%else%>
<img class="imgLink" src="<%=imagesFolder%>/email_grey.gif" alt="" />
<%end if%>
<%if not rs("userqq")="" then%><a target="blank" href="http://wpa.qq.com/msgrd?V=1&Uin=<%=userqq%>&Site=<%=site%>&Menu=yes"><img class="imgLink" src="<%=imagesFolder%>/qq.gif" alt="向“<%=HTMLencode(rs("username"))%>”的QQ發(fā)起臨時(shí)會(huì)話(QQ軟件須開啟)" /></a>
<%else%>
<img class="imgLink" src="<%=imagesFolder%>/qq_grey.gif" alt="" />
<%end if%>
</div>
<div class="msgContent"><table><tr><td><%=usercontent%></td></tr></table></div>
<%if rs("reply")=1 then%>
<div class="msgReply">
<div class="msgReply-top"><b>管理員回復(fù) : </b>( <%=retime%> )</div>
<div class="msgReply-content"><table><tr><td><%=recontent%></td></tr></table></div>
</div>
<%end if%>
</div>
<%if login then%>
<div class="adminLinks">
<%if rs("checked")=0 then%>
<a href="javascript:go('admin.asp?act=check&id=<%=rs("id")%>&Referer=<%=Request.ServerVariables("HTTP_URL")%>','您確定要通過審核?')"><span class="Highlight">通過審核</span></a>
<%end if%>
<a href="javascript:go('admin.asp?act=del&id=<%=rs("id")%>&Referer=<%=Request.ServerVariables("HTTP_URL")%>','您確定要?jiǎng)h除?')">刪除</a>
<%if rs("whisper")=1 and rs("replycode")="" then%>
<span class="Highlight">無法回復(fù)的悄悄話</span>
<%else%>
<a href="reply.asp?id=<%=rs("id")%>"><%if rs("whisper")=1 then%><span class="Highlight">悄悄話回復(fù)/編輯回復(fù)</span><%else%>回復(fù)/編輯回復(fù)<%end if%></a><%end if%> <a href="edit.asp?id=<%=rs("id")%>">編輯</a> 留言IP:<%=rs("ip")%>
</div>
<%end if%>
<%end if%>
<div class="msgArea-clear"></div>
</div>
<%
page_count = page_count + 1
rs.movenext
wend
%>
<div class="divLine"></div>
<%
call pages()
rs.close
set rs=nothing
end function
sub pages() '//////// 分頁代碼
%>
<div class="page">
<%
dim ii,p,n
if totalrec mod perpage=0 then
n= totalrec \ perpage
else
n= totalrec \ perpage+1
end if
p=(currentpage-1) \ 5
%>
搜索“<span class="Highlight"><%=back_filter(key)%></span>” 頁次:<b><%=currentpage%>/<%=n%></b>頁,每頁<b><%=rs.pagesize%></b>條,共<b><%=totalrec%></b>條
<%if currentpage=1 then%>首頁
<%else%><a href="?key=<%=back_filter(key)%>&page=1" title="首頁">首頁</a>
<%end if%>
<%if p*5>0 then%>
<a href="?key=<%=back_filter(key)%>&page=<%=cstr(p*5)%>" title="上五頁">上翻</a>
<%end if
for ii=p*5+1 to p*5+5
if ii=currentpage then%>
<span class="currtNum"><%=cstr(ii)%></span>
<%else%>
<a href="?key=<%=back_filter(key)%>&page=<%=cstr(ii)%>"><%=cstr(ii)%></a>
<%end if
if ii=n then exit for
next
%>
<%if ii<n then%>
<a href="?key=<%=back_filter(key)%>&page=<%=cstr(ii)%>" title="下五頁">下翻</a>
<%end if%>
<%if currentpage=n then%>
尾頁
<%else%>
<a href="?key=<%=back_filter(key)%>&page=<%=cstr(n)%>" title="尾頁">尾頁</a>
<%end if%>
</div>
<%
end sub
Function Boldkey(strContent,key) '//////// 加亮關(guān)鍵字
dim B_key
Set B_key=new RegExp
B_key.IgnoreCase =true
B_key.Global=True
B_key.Pattern="(" & key & ")"
strContent=B_key.Replace(strContent,"<span class=""keyword"">$1</span>" )
Set B_key=Nothing
Boldkey=strContent
End Function
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -