📄 blog_search.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--#include file="../include/datatransfer.asp"-->
<!--#include file="../include/functionjs.asp"-->
<!--#include file="../include/functionvb.asp" -->
<!--#include file="../include/dbconn.inc" -->
<!--#include file="../include/refresh.asp"-->
<!--#include file="../include/header.asp" -->
<link href="../include/main.css" rel="stylesheet" type="text/css">
<%
if UserID=empty then
response.Redirect("../common/showerr.asp?ErrType=1")
end if
%>
<table width="710" border="1" cellpadding="2" cellspacing="0" align="center" class="tablestyle" bordercolor="#FFFFFF">
<tr>
<td bordercolor="#4C4C4C" background="../resource/images/bbs/bg.gif" class="tablehead"> <img src="../resource/images/blog/li.gif" width="12" height="12"> <%=username%>,您的位置: <a href="../blog/main.asp">56Blog</a> → Blog搜索</td>
</tr>
<tr>
<td bordercolor="#4C4C4C"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200" valign="top" style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word"><!--#include file="../include/blog_leftprv.asp"--></td>
<td width="510" valign="top">
<br>
<%
dim action
action=request("action")
if action="post" then
dim KeyWord,NSearch,PSearch,SearchDate1,SearchDate2
keyword=trim(request("keyword"))
NSearch=request("NSearch")
if nsearch=0 then nsearch=1
PSearch=request("PSearch")
if psearch="" then psearch=1
if request.Form("SearchDate")<>0 then
SearchDate1=" and #"& now() &"#-blog_topic.pubtime<"&request.Form("SearchDate")
SearchDate2=" and #"& now() &"#-blog_reply.pubtime<"&request.Form("SearchDate")
end if
if request("sType")=1 then
strsql="select * from user_info where user_name='"&keyword&"'"
objRS.open strSQL,objConn,1,1
if objrs.eof and objrs.bof then response.Redirect("../common/showerr.asp?ErrType=5")
objrs.close
select case nSearch
case 1
strSQL="select * from blog_topic where user_name='"& keyword&"' "& SearchDate1&" order by pubtime desc"
case 2
strSQL="select blog_reply.*,blog_topic.user_id,blog_topic.topic_id,blog_topic.user_name,blog_topic.title,blog_topic.pubtime from blog_reply,blog_topic where blog_topic.topic_id=blog_reply.topic_id and blog_reply.user_name='"& keyword&"' "& SearchDate2&" order by blog_reply.pubtime desc"
end select
else
nSearch=0
select case PSearch
case 1
strSQL="select * from blog_topic where title like '%"& keyword&"%' "& SearchDate1&" order by pubtime desc"
case 2
strSQL="select * from blog_topic where content like '%"& keyword&"%' "& SearchDate1&" order by pubtime desc"
case 3
strSQL="select blog_reply.*,blog_topic.user_id,blog_topic.topic_id,blog_topic.user_name,blog_topic.title,blog_topic.pubtime from blog_reply,blog_topic where blog_topic.topic_id=blog_reply.topic_id and blog_reply.title like '%"& keyword&"%' "& SearchDate2&" order by blog_reply.pubtime desc"
case 4
strSQL="select blog_reply.*,blog_topic.user_id,blog_topic.topic_id,blog_topic.user_name,blog_topic.title,blog_topic.pubtime from blog_reply,blog_topic where blog_topic.topic_id=blog_reply.topic_id and blog_reply.content like '%"& keyword&"%' "& SearchDate2&" order by blog_reply.pubtime desc"
end select
end if
objRS.open strSQL,objConn,1,1
%>
<table width="480" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#D6E7FF"style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word BORDER-LEFT: #000000 1PX DASHED; BORDER-RIGHT: #000000 1PX DASHED; BORDER-TOP: #000000 1PX DASHED; BORDER-BOTTOM: #000000 1PX DASHED">
<tr>
<td align="center">Blog搜索结果</td>
</tr>
</table><br>
<%
if PSearch=1 or PSearch=2 or nsearch=1 then
do while not objRS.eof
%>
<table width="480" border="0" cellspacing="2" cellpadding="2" align="center" <%if i mod 2 =0 then response.Write("bgcolor='#EFEBEF'")%> style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word BORDER-LEFT: #000000 1PX DASHED; BORDER-RIGHT: #000000 1PX DASHED; BORDER-TOP: #000000 1PX DASHED; BORDER-BOTTOM: #000000 1PX DASHED">
<tr>
<td><pre><font color="#FF6600"><%=objrs("title")%></font> 由<%=objrs("user_name")%> 发表于 <%=objrs("pubtime")%></pre></td>
</tr>
<tr>
<td align="right">
<table width="450" border="0" cellspacing="0" cellpadding="0"style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word">
<tr>
<td><pre><%=objrs("content")%></pre></td>
</tr>
</table></td>
</tr>
<tr>
<td align="right">[<a href="blog_reply.asp?TopicID=<%=objrs("topic_id")%>"><font color="#FF3399">评论</font></a>] [<a href="blog_cmd.asp?TopicID=<%=objrs("topic_id")%>"><font color="#FF3399">推荐</font></a>] [推荐度:<%=objrs("commendcount")%>] [<a href="blog_show.asp?ShowID=<%=showid%>&TopicID=<%=objrs("topic_id")%>" title="阅读评论"><img src="../resource/images/blog/li2.gif" width="9" height="9" border="0">评论<%=objrs("replycount")%>篇</a>]<a name="0"></a></td>
</tr>
</table>
<br><%
objRs.movenext
loop%>
<%
else
do while not objRS.eof
%>
<table width="480" border="0" cellspacing="2" cellpadding="2" align="center" <%if i mod 2 =0 then response.Write("bgcolor='#EFEBEF'")%>style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word BORDER-LEFT: #000000 1PX DASHED; BORDER-RIGHT: #000000 1PX DASHED; BORDER-TOP: #000000 1PX DASHED; BORDER-BOTTOM: #000000 1PX DASHED">
<tr>
<td><pre><font color="#FF6600"><%=objrs("blog_reply.title")%></font>,此评论由<%=objrs("blog_reply.user_name")%> 发表于 <%=objrs("blog_reply.pubtime")%></pre></td>
</tr>
<tr>
<td align="right">
<table width="450" border="0" cellspacing="0" cellpadding="0"style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word">
<tr>
<td><pre><%=objrs("content")%></pre></td>
</tr>
</table></td>
</tr>
<tr>
<td align="right"><br>评论对象:<%=objrs("blog_topic.user_name")%>于<%=objrs("blog_topic.pubtime")%>发表的《<b><%=objrs("blog_topic.title")%></b>》
[<a href="blog_show.asp?ShowID=<%=showid%>&TopicID=<%=objrs("blog_topic.topic_id")%>"><img src="../resource/images/blog/li2.gif" width="9" height="9" border="0">查看源日记</a>]</td>
</tr>
</table>
<br><%
objRs.movenext
loop
end if
else%>
<table width="480" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#D6E7FF"style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word BORDER-LEFT: #000000 1PX DASHED; BORDER-RIGHT: #000000 1PX DASHED; BORDER-TOP: #000000 1PX DASHED; BORDER-BOTTOM: #000000 1PX DASHED">
<tr>
<td align="center">Blog搜索</td>
</tr>
</table><br>
<table width="480" border="0" align="center" cellpadding="2" cellspacing="2" style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word BORDER-LEFT: #000000 1PX DASHED; BORDER-RIGHT: #000000 1PX DASHED; BORDER-TOP: #000000 1PX DASHED; BORDER-BOTTOM: #000000 1PX DASHED">
<tr>
<td><b>搜索说明</b>:<br>
<ul>
<li> 关键字字符长度不能小于 <b>2</b> 大于 <b>20</b> 字节,<a
title="~,!,@,#,$,%,^,&,*,(,),_,+,=,`,[,],{,},;,:,,',,,<,>,.,/,\,|,?,_,about 1,2,3,4,5,6,7,8,9,0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z after,all,also,an,and,another,any,are,as,at,be,because,been,before,being,between both,but,by,came,can,come,could,did,do,each,for,from,get,got,had has,have,he,her,here,him,himself,his,how,if,in,into,is,it,like,make,many me,might,more,most,much,must,my,never,now,of,on,only,or,other,our out,over,said,same,see,should,since,some,still,such,take,than,that,the,their them,then,there,these,they,this,those,through,to,too,under,up,very,was way,we,well,were,what,where,which,while,who,with,would,you,your 的,一,不,在,人,有,是,为,以,于,上,他,而,后,之,来,及,了,因,下,可 到,由,这,与,也,此,但,并,个,其,已,无,小,我,们,起,最,再 今,去,好,只,又,或,很,亦,某,把,那,你,乃,它">在这里看搜索被限的字符</a>
<li> 按 用户名 查询为精确查询,必须输入用户名的全称
</ul></td>
</tr>
</table>
<form name="form" method="post" action="blog_search.asp?action=post" onSubmit="return checkin(this)">
<table width="480" border="0" cellspacing="2" cellpadding="2" align="center" bgcolor="#EFEBEF" style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word BORDER-LEFT: #000000 1PX DASHED; BORDER-RIGHT: #000000 1PX DASHED; BORDER-TOP: #000000 1PX DASHED; BORDER-BOTTOM: #000000 1PX DASHED">
<tr>
<td width="120" align="right">关键字: </td>
<td width="345"><input size=20 name=keyword></td>
</tr>
<tr>
<td valign="top" align="right">作者搜索
<input type=radio value=1 name=sType></td>
<td><select name=NSearch>
<option value=1 selected>搜索日记作者 </option>
<option value=2>搜索评论作者 </option>
</select></td>
</tr>
<tr>
<td valign="top" align="right">关键字搜索
<input type=radio checked value=2 name=sType></td>
<td><select name=PSearch>
<option value=1 selected>在日记标题中搜索关键字 </option>
<option value=2>在日记内容中搜索关键字</option>
<option value=3>在评论标题中搜索关键字</option>
<option value=4>在评论内容中搜索关键字</option>
</select></td>
</tr>
<tr>
<td valign="top" align="right">日期范围</td>
<td><select name=SearchDate>
<option value=0 selected>所有日期
<option value=1>昨天以来
<option value=5>5天以来
<option value=10>10天以来
<option value=30>30天以来</option>
</select></td>
</tr>
<tr>
<td valign="top"> </td>
<td> <input type="submit" name="Submit2" class="input"value="搜索">
<input type="reset" name="reset2" class="input"value="取消"></td>
</tr>
</table>
</form>
<%end if%>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td bordercolor="#4C4C4C" background="../resource/images/bj2.gif" align="center"> </td>
</tr>
</table>
<script language="vbscript">
Function checkin(myform)
checkin=true
if (trim(myform.keyword.value)="") then
msgbox ("请填写查询内容!")
checkin= false
exit function
end if
dim strforbid,arrforbid
strforbid="~,!,@,#,$,%,^,&,*,(,),_,+,=,`,[,],{,},;,:,,',,,<,>,.,/,\,|,?,_,about 1,2,3,4,5,6,7,8,9,0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z after,all,also,an,and,another,any,are,as,at,be,because,been,before,being,between both,but,by,came,can,come,could,did,do,each,for,from,get,got,had has,have,he,her,here,him,himself,his,how,if,in,into,is,it,like,make,many me,might,more,most,much,must,my,never,now,of,on,only,or,other,our out,over,said,same,see,should,since,some,still,such,take,than,that,the,their them,then,there,these,they,this,those,through,to,too,under,up,very,was way,we,well,were,what,where,which,while,who,with,would,you,your 的,一,不,在,人,有,是,为,以,于,上,他,而,后,之,来,及,了,因,下,可 到,由,这,与,也,此,但,并,个,其,已,无,小,我,们,起,最,再 今,去,好,只,又,或,很,亦,某,把,那,你,乃,它"
arrforbid=split(strforbid,",")
for each i in arrforbid
if i=trim(myform.keyword.value) then
msgbox ("您输入非法查询字符,请重新输入!")
checkin= false
exit function
end if
next
end Function
</script>
<!--#include file="../include/endconn.inc" -->
<!--#include file="../include/footer.asp" -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -