www.gusucode.com > 乐学迷你BBS 2.2 ACCESS GB2312 版源码程序 > 乐学迷你BBS 2.2 ACCESS GB2312 版/lbbsaccessgb/search.asp

    <!--#include file="include/head.asp"-->
<%
'**************************************
'**		search.asp
'**
'** 文件说明:贴子搜索文件
'** 版 本 号:v2.2 access gb2312版
'** 修改日期:2008-05-22
'** 作    者:learn365
'** 网    站:http://www.learn365.cn
'**************************************
%>
<!--#include file="include/header.asp"-->
<script language="javascript" src="include/mouse_on_title.js"></script>
<%Dim Page,Pages,PageSize,AllCount,ShowCount,PastCount,OrderMode,forumID,bgcolor,Form_Title,Form_Context,forumName,j,PageEndTime,PageRunTime,keyword,fid,suserid,content,content_preview,title,poster,lastupdateuser,strWhere,strOrder,status,strLength,allreplies
forumID=SqlShow(Request("fid"))
keyword=SqlShow(Request("keyword"))
suserid=SqlShow(request("userid")) 
content=sqlshow(request("postcontent"))
allreplies=sqlshow(request("allreplies"))
Page=Max(Cnum(Request("page")),1)
PageSize=20
status="页面搜索"
if forumid="all" then
forumid=""
end if
if user_id = "" then
	Call ShowError("注册用户登录后才能使用搜索功能!",1)
end if
if keyword="" and suserid="" and content="" then
	Call ShowError("未输入搜索内容,请重新输入!",1)
end if
'search by title
dim strSql0,strSql1,strSql2,strSql3,strSql4
if allreplies="ON" then strSql0="" else strSql0=" and parent=0"
if suserid<>"" then strSql1=" and poster='" &suserid& "'" else strSql1=""
if keyword<>"" then strSql2=" and parent=0 and title like '%" & keyword & "%'" else strSql2=""
if content<>"" then strSql3=" and content like '%" & content & "%'" else strSql3=""
if forumID<>"" Then strSql4="classID=" &forumID& "" else strSql4="classID>0"
Sql="SELECT * FROM content WHERE "&strSql4&strSql1&strSql2&strSql3&strSql0&" order by SetTop desc, LastUpdateTime desc"
OpenRs(Sql)
Response.write("<div class=centerbg ><div class=mainbar0 style=""text-align:left;PADDING-BOTTOM: 2px; PADDING-TOP: 2px"">")
'show pages
AllCount=Rs.RecordCount
Pages=Fix(AllCount/PageSize)
If Pages*PageSize<AllCount Then
	Pages=Pages+1	
End If
PastCount=(Page-1)*PageSize
If PastCount>=AllCount Then
	Page=1
	PastCount=0
End If
Response.write ShowPages(Pages,Page,"search.asp?userid="&suserid&"&keyword="&keyword&"&postcontent="&content&"&fid="&forumid&"&allreplies="&allreplies&"")
If AllCount>PastCount Then
	Rs.Move PastCount
End If
ShowCount=Min(AllCount-PastCount,PageSize) 
Response.write("</div><div class=""th""><DIV style=""FLOAT: left; MARGIN-LEFT: 3px; ""><a href=""javascript:history.go(-1);"">【返回】</a></div><div class=listtitle style='margin-left:80px;'>")
if forumid="" then
Response.write("<font color=""#cc0000"">【全部贴子列表】</font>")
else
Response.write("<font color=""#cc0000"">【"&Application(systemkey&Cnum(ForumID))&"】</font>")
end if
Response.write("搜索结果</div>")
Response.write("<DIV class=list_r1 style=""width:235px;""><DIV class=list1 style=""WIDTH: 80px"">【发贴人】</div><DIV class=list1 style=""WIDTH:150px"">【最后更新】</div></div></div>")
'未搜索到结果页
if rs.recordcount = 0 then
response.write "<div class=list style='text-align:center;'>未搜索到结果!<br></div>"
end if
if css_style="wide.css" then strlength=70 else strlength=52
For i=1 To ShowCount
if i mod 2 = 0 then 
   bgcolor = "list_o"
   else
   bgcolor = "list" 
end if
title=Rs("Title")
if strlen(title)>strlength Then title=CutStr(title,strlength)
poster=Rs("poster")
lastupdateuser=Rs("lastupdateuser")
content_preview=Server.HtmlEncode(strvalue(Rs("content"),200))
Response.write("<div onmouseover=""this.className='ahover'"" onmouseout=""this.className='"&bgcolor&"'"" class="""&bgcolor&""" id=""subject""><div class=""list_img"" style=""MARGIN-TOP: 2px;"">")
if Rs("parent")=0 then
Response.write("<img  alt=""主题贴"" src=""images/new.gif"" width=""11"" height=""11"">")
Else
Response.write("<img  alt=""回复贴"" src=""images/common.gif"" width=""11"" height=""11"">")
End If
Response.write("</div><div class=""listtitle1"">")
if Rs("parent")=0 then
			Response.write "<a  href=index.asp?forumID=" & Rs("classID") &  ">" & "[" & Application(systemkey&Rs("classID")) &"]" & "</a>"& "&nbsp;&nbsp;" &  "<a class='title' alt=""<table width='400'><tr><td>"&server.htmlencode(content_preview)&"</td></tr></table>"" target=_blank href="""&strUrl2&"?id=" & Rs("id") & """>"  &  title & "</a></div>"
	else 
			Response.write "<a  href=index.asp?forumID=" & Rs("classID") &  ">" & "[" & Application(systemkey&Rs("classID")) &"]" & "</a>"& "&nbsp;&nbsp;" &  "<a alt=""<table width='400'><tr><td>"&server.htmlencode(content_preview)&"</td></tr></table>"" target=_blank href="""&strUrl2&"?id=" & Rs("parent") & "&listMethod=search##"&Rs("id")&""">"  &  title & "</a></div>"
     end if
If Rs("SetTop")=1 Then
	Response.write "<div class='list_img'>&nbsp;<font color=blue>[顶]</font></div>"
End If
If Rs("Classic")=1 Then
	Response.write "<div class='list_img'><font color=red>&nbsp;[荐]</font></div>"
End If
If Rs("lock")=true Then
	Response.write "<div class='list_img'><font color=orange>&nbsp;[锁]</font></div>"
End If

'添加图片标识
If Rs("isPic")=True Then
Response.write("<div class='list_img'><img alt=""该贴包含图片"" src=""images/Pic.gif"" ></div>")
End If

'添加附件标识
If Rs("upfilelist")<>"" Then
Response.write("<div class='list_img'><img  alt=""此贴包含附件"" src=""images/attachment.gif""  border=""0"" width=""15"" height=""15""></div>")
End If

Response.write("<div class=""list_r"" style=""width:235px;""><div class=""list_a""><a href=""javascript:memberinfo('" & poster & "')"">" & poster & "</a></div><div class=""list_t"" style=""width:150px;text-align:left;""><font color=""#505050"">" & OnlyDate(Rs("LastUpdateTime")) & "</font><font color=red> | </font><a href=""javascript:memberinfo('" & Rs("LastUpdateUser") & "')"">" & LastUpdateUser & "</a></div></div></div>")
Rs.MoveNext
Next
Rs.Close
Response.write("<div class=""listpages"" id=""pages""><div style=""FLOAT:left; MARGIN-LEFT: 5px;padding-top:5px;"">类别:<img  alt=""主题贴"" src=""images/new.gif"" width=""11"" height=""11"">&nbsp;主题贴&nbsp;&nbsp;<img  alt=""回复贴"" src=""images/common.gif"" width=""11"" height=""11"">&nbsp;回复贴</div><div style=""FLOAT:right;padding-top:2px;margin-right:2px;""><form method=""POST"" action=""search.asp?userid="&suserid&"&keyword="&keyword&"&postcontent="&content&"&fid="&forumid&""">[共搜索到<font color='#cc0000'>"&allcount&"</font>个主题/贴子&nbsp;|&nbsp;每页<font color='#cc0000'>"&Pagesize&"</font>个]&nbsp;第"&page&"页/共"&pages&"页&nbsp; 页码:<input type=""text"" name=""page"" size=""4"" class=""input"">&nbsp;<input type=""submit"" value=""GO"" name=""B5"" class=""button"">&nbsp;&nbsp;")
if page>1 then
Response.write("<a href=""search.asp?userid="&suserid&"&keyword="&keyword&"&postcontent="&content&"&fid="&forumid&"&page="&page-1&"&allreplies="&allreplies&""">[上一页]</a>")
else
Response.write "<font color=gray>[上一页]</font>"
end if
if page<pages then
Response.write("<a href=""search.asp?userid="&suserid&"&keyword="&keyword&"&postcontent="&content&"&fid="&forumid&"&page="&page+1&"&allreplies="&allreplies&""">&nbsp;[下一页]</a>")
else
Response.write "<font color=gray>&nbsp;[下一页]</font>"
end if
Response.write("</form></div></div>")
Response.write("<div id=waiting style=""position:absolute;top:50px;left:100px;z-index:1;visibility:hidden"" ><layer name=waiting visibility=visible zIndex=99 ><div class=loader>数据正在处理中...</div></layer></div>")
%>
<!--#include file="include/search_in.asp"-->
<!-- #include file="include/footer.asp" -->