📄 query.asp
字号:
<!--#include file="MarcosCB.asp"-->
<%
getConn()
isIn()
dim str,page,body,pageTitle,pageOther,pageCode
page=getPost("page")
theAct=getPost("theAct")
if not isNumeric(page) then
page=1
end if
str=getMainCode(mySkinId)
pageCode=getPageCode(mySkinId,"PageSearch")
PageQuery=split(pageCode,"$$$")
pageTitle="<a href=javascript:location.reload();>论坛搜索</a>"
pageOther="<script>document.title+=' - 论坛搜索';</script>"
nowWhere "论坛搜索","query.asp"
showHead str,pageTitle,pageOther
if getPost("key")="" and getPost("keyOne")="" and theAct<>"showMyTopic" and theAct<>"showMyReply" then
theAct=""
end if
select case theAct
case ""
showTop()
case "findUser"
showTop()
showUser()
case "findBBS"
showTop()
showBBS()
case "showMyTopic"
locate "query.asp?theAct=findBBS&page=1&keyOne=topic&keyTwo=userName&keyWord="&getValue("userName")
case "showMyReply"
locate "query.asp?theAct=findBBS&page=1&keyOne=reply&keyTwo=userName&keyWord="&getValue("userName")
end select
showFoot(str)
rem ====================== 本页面代码(BODY)显示 =========================
sub showUser()
dim i,sql,body,keyOne,keyWord
body=PageQuery(1)
key=replace(getPost("key"),"'","''")
keyWord=replace(getPost("keyWord"),"'","''")
select case key
case "userGroup"
sql="select userName,regDate,lastLogin from Marcos_User where userGroup like '%"&keyWord&"%'"
case "userName"
sql="select userName,regDate,lastLogin from Marcos_User where userName like '%"&keyWord&"%'"
case "oldOne"
sql="select top 20 userName,regDate,lastLogin from Marcos_User order by regDate desc"
case "newOne"
sql="select top 20 userName,regDate,lastLogin from Marcos_User order by regDate"
end select
rs.open sql,conn,1,1
rs.pageSize=listNum
if not rs.eof then
rs.absolutePage=page
end if
for i=1 to listNum
if rs.eof then
exit for
end if
body=body&PageQuery(2)
body=replace(body,"{$regDate}",rs(1))
body=replace(body,"{$userName}",rs(0))
body=replace(body,"{$lastLogin}",rs(2))
rs.movenext
next
for i=1 to rs.pageCount
pageList=pageList&"<a href=""?theAct=findUser&page="&i&"&key="&key&"&keyWord="&keyWord&"""><font {$pageNum"&i&"}>"&i&"</font></a> "
next
pageList=replace(pageList,"{$pageNum"&page&"}","class=warningColor")
rs.close
queryTimes=queryTimes+1
if pageList="" then
pageList=replace(pageList,"[ ]","<div align=center>对不起,没有找到任何匹配的记录!</div>")
end if
body=body&PageQuery(3)
body=replace(body,"{$pageList}",pageList)
echo body
end sub
sub showBBS()
dim i,sql,body,keyOne,keyTwo,keyWord,keyOneList
keyOne=lcase(replace(getPost("keyOne"),"'","''"))
keyTwo=replace(getPost("keyTwo"),"'","''")
keyWord=replace(getPost("keyWord"),"'","''")
keyOneList="$topic$reply$"
body=PageQuery(4)
if instr(keyOneList,"$"&keyOne&"$")<=0 then
echo "错误的参数提交!"
closeConn()
response.end
end if
if keyOne="topic" then
lastReplyTime="lastReplyTime"
else
lastReplyTime="replyTime"
end if
select case keyTwo
case "Title","Content"
sql="select * from Marcos_"&keyOne&" where isRecycled=false and "&keyOne&keyTwo&" like '%"&keyWord&"%' order by "&lastReplyTime&" desc"
case "userName"
sql="select * from Marcos_"&keyOne&" where isRecycled=false and userName like '%"&keyWord&"%' order by "&lastReplyTime&" desc"
case "all"
sql="select * from Marcos_"&keyOne&" where isRecycled=false and "&keyOne&"Title like '%"&keyWord&"%' or "&_
keyOne&"Content like '%"&keyWord&"%' or userName like '%"&keyWord&"%' order by "&lastReplyTime&" desc"
end select
if keyOne="reply" then
sql=replace(sql,"*","topicId")
sql="select * from Marcos_Topic where isRecycled=false and topicId in("&sql&") order by lastReplyTime desc"
end if
rs.open sql,conn,1,1
rs.pageSize=listNum
if not rs.eof then
rs.absolutePage=page
end if
for i=1 to rs.pageSize
if rs.eof then
exit for
end if
body=body&PageQuery(5)
if len(rs("topicTitle"))<=21 then
topicTitle=rs("topicTitle")
else
topicTitle=left(rs("topicTitle"),21) & "..."
end if
if rs("isBest")=true then
topicTitle="<font class=""warningColor"">[精华]</font>"&topicTitle
end if
if rs("isTop")=true then
topicTitle="<font class=""warningColor"">[置顶]</font>"&topicTitle
end if
body=replace(body,"{$topicTitle}",topicTitle)
updateUser=split(split(rs("lastPostInfo"),"$$$")(0),"@@")(1)
body=replace(body,"{$addTime}",rs("lastReplyTime")&" | <a href=""userInfo.asp?userName="&updateUser&""" target=_blank>"&updateUser&"</a>")
body=replace(body,"{$userName}",rs("userName"))
body=replace(body,"{$mood}"," <img src=""" & rs("topicMood") & """ border=0>")
body=replace(body,"{$lastPostInfo}",replace(replace(rs("lastPostInfo"),"$$$","<br>"),"@@",""))
body=replace(body,"{$topicLink}","topicShow.asp?boardId=" & rs("boardId") & "&topicId=" & rs("topicId"))
rs.movenext
next
for i=1 to rs.pageCount
pageList=pageList&"<a href=""?theAct=findBBS&page="&i&"&keyOne="&keyOne&"&keyTwo="&keyTwo&"&keyWord="&keyWord&_
"""><font {$pageNum"&i&"}>"&i&"</font></a> "
next
pageList=replace(pageList,"{$pageNum"&page&"}","class=warningColor")
body=body&PageQuery(6)
if rs.recordCount=0 then
body=replace(body,"{$pageList}","<div align=center>对不起,没有找到任何匹配的记录!</div>")
end if
body=replace(body,"{$pageList}",pageList)
rs.close
queryTimes=queryTimes+1
echo body
end sub
sub showTop()
echo PageQuery(0)
end sub
closeConn()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -