⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search.asp

📁 BBS论坛的开发和设计
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="admin/BBSConfig.asp"-->
<!--#include file="INC/online.asp"-->
<!--#include file="INC/ShowMsg.asp"-->
<!--#include file="INC/header.asp"-->
<!--#include file="INC/style.asp"-->
<%
'****************************************************************
'*  joinboard BBS Ver2.3.0/友盟论坛 Ver2.3.0
'*
'*  版权所有: JoinBoard V2.3
'*
'*  程序制作: 友盟工作室
'*           
'*  主页地址: http://joinboard.com    友盟论坛
'*
'*  论坛地址: http://bbs.joinboard.com/、http://youmeng.com
'*	                 
'****************************************************************
'*  Powered by: JoinBoard V2.3
'* Copyright 2003-2004.  - All Rights Reserved.
'*  JoinBoard is a trademark of YouMeng Studio.
'****************************************************************

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="joinboard,forum,bbs,youmeng,友盟论坛">
<title><%=BBS_Config(0)%> - 搜索</title>
<link href="<%=Css_path%>" rel="stylesheet" type="text/css">
<script language="javascript">
<!--
function isok(theform)
{
if (theform.key.value==""&&theform.username.value=="")
  {
    alert("请输入搜索关键字或者输入用户名!");
    theform.key.focus();
    return (false);
  }
return (true);
}
-->
</script>
</head>
<body leftmargin="0" topmargin="0">
<%
Call onlineuser()
call top()

response.Write "<table border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" class=""path-table"">"
response.Write "<tr><td>"
response.write "<img src="""& BBS_Skin(3) &"JBB_bullet.gif""> <a href="""& BBSHomeUrl &""">"& BBS_Config(0) &"</a> <img src="""& BBS_Skin(3) &"JBB_bullet.gif""> <a href=""search.asp"">搜索</a>" 
response.Write "</td></tr></table>"

if user_group(5) <> true then
	loginform "您不可以使用搜索功能或者您还没有登录,如果您还不是本站会员,请<a href=""register.asp?action=agree"">注册</a>"
	Call Bottom()
	response.End()
End if
'----------------------------------------
if trim(request.querystring("action")) <> "search" then
%><br>

<form name="form1" method="post" action="?action=search" onsubmit="return isok(this)">
  <table border="0" align="center" cellpadding="5" cellspacing="1" class="table">
    <tr class="table-title"> 
      <td colspan="2"> 
        <div align="center"><strong>搜 索</strong></div></td>
    </tr>
    <tr class="table-light"> 
      <td width="40%" class="table-light"> 
        <div align="right">按关键词: </div></td>
      <td width="246"><input name="key" type="text" id="key2"> </td>
    </tr>
    <tr class="table-light"> 
      <td class="table-light"><div align="right">按用户名:</div></td>
      <td><input name="username" type="text" id="username"></td>
    </tr>
    <tr class="table-light"> 
      <td class="table-light"><div align="right">贴子时间:</div></td>
      <td><select name="times" id="times">
          <option value="2">2天以内</option>
          <option value="10" selected>10天以内</option>
          <option value="30">30天以内</option>
          <option value="60">60天以内</option>
          <option value="180">半年以内</option>
          <option value="0">所有的时间</option>
        </select></td>
    </tr>
    <tr class="table-light">
      <td class="table-light"><div align="right">所在论坛:</div></td>
      <td><select name="Board" id="Board">
          <option value="0" selected>在所有的论坛搜索</option>
          <%
			set rs = server.CreateObject("adodb.recordset")
			sql = "select JBB_Class.Class_name,JBB_Class.Class_ID,JBB_Board.BoardID,JBB_Board.title From JBB_board left join JBB_Class on (JBB_Board.ClassID = JBB_Class.Class_ID) order By JBB_Class.Class_order,JBB_Board.Boardorder asc"
			rs.open sql,conn,1,1
			if Not(rs.Bof and rs.Eof) then
				id = 0
				for board = 1 to rs.recordCount
				if id <> rs("Class_id") then
         			response.Write"<option value=""Class_"& rtrim(rs("Class_ID")) &""">==="&rtrim(rs("Class_name"))&"===</option>"
					id = rs("Class_id")
				End if
				response.Write"<option value="""& trim(rs("BoardID")) &""">  "&rtrim(rs("title"))&"</option>"
				rs.MoveNext
				Next
			End if
			rs.Close
			set rs = Nothing
			%>
        </select></td>
    </tr>
    <tr class="table-light"> 
      <td class="table-light"><div align="right">选项:</div></td>
      <td><input name="title" type="radio" value="yes" checked>
        在标题中搜索 &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="title" value="no">
        在贴子中搜索</td>
    </tr>
    <tr class="table-light"> 
      <td colspan="2"> 
        <div align="center"> 
          <input type="submit" name="Submit" value="开始搜索">
        </div></td>
    </tr>
  </table>
</form>
<br>

<%
else
	searchin = trim(request.QueryString("searchin"))
	if searchin="Getnew" then
		sql = "select JBB_Board.BoardID,JBB_Board.title,JBB_post.threadid,JBB_post.posttitle,JBB_post.posttime,JBB_post.user_name,JBB_post.user_id From JBB_board left join JBB_post on(JBB_post.Board_ID=JBB_Board.BoardID) where DATEDIFF('d', JBB_post.posttime, '"& now() &"') <1 order by posttime desc"
		'sql = "Select JBB_Board.*,JBB_post.* from JBB_post join (Select min(postid) as postid,threadid from JBB_post group by threadid) JBB_Board on JBB_post.Board_ID=JBB_Board.BoardID order by JBB_post.threadid,JBB_post.posttime desc"
		pageurl = "search.asp?action=search&searchin=Getnew"
	else
		key = replace(trim(request("key")),"'","")
		key = replace((key),"[","")
		username = replace(trim(request.QueryString("username")),"'","")
		if username = "" then username = replace(trim(request.form("username")),"'","")
		if username = "" and key = "" then
			ShowMsg "搜索条件不可为空! 请点击 <a href=""javascript:history.back()"">这里</a> 返回"
			Call Bottom()
			response.End()
		End if
		title = trim(request("title"))
		if username <> "" then
			search1 = " JBB_post.user_name='"& username &"'"
		else
			if title = "yes" and key <> "" then
				search1 = " JBB_post.posttitle like '%"& key &"%'"
			elseif title <> "yes" and key <> "" then
				search1 = " JBB_post.postcontent like '%"& key &"%'"
			End if
		End if
		intimes = request.form("times")
		if intimes = "" then intimes = request.querystring("intimes")
		if IsNumeric(intimes) and intimes <> "0" and intimes <> "" then
			search2 = " and DATEDIFF('d', JBB_post.posttime, '"& now() &"') <= "&intimes
		End if
		Board = trim(request("Board"))
		if Board <> "0" then
			if left(Board,6) = "Class_" then
				Board = replace(Board,"Class_","")
				set rs = server.CreateObject("adodb.recordset")
				rs.open "select BoardID From JBB_board where ClassID="&Board,conn,1,1
				if Not rs.eof then
					Board = ""
					for b = 1 to rs.recordCount
						Board = Board & rs("BoardID") &","
					rs.MoveNext
					Next			
					Boardlen=len(Board)
					Board=left(Board,Boardlen-1)
				End if
				rs.close
				set rs = nothing
			End if
			if Board <> "" then
				search3 = " and JBB_post.Board_ID in("& Board &")"
			End if
		End if
		sql = "select JBB_Board.BoardID,JBB_Board.title,JBB_post.threadid,JBB_post.posttitle,JBB_post.posttime,JBB_post.user_name,JBB_post.user_id From JBB_board left join JBB_post on(JBB_post.Board_ID=JBB_Board.BoardID) where "&search1&search2&search3&" order by posttime desc"
		pageurl = "search.asp?action=search&key="&key&"&username="& username &"&intimes="& intimes &"&board="&board&"&title="&title
	End if
	'response.Write(sql)
	set rs = server.CreateObject("adodb.recordset")
	rs.open sql,conn,1,1
%>
<br>
<table border="0" align="center" cellpadding="4" cellspacing="1" class="table">
  <tr class="table-title"> 
    <td colspan="4"><%=BBS_Config(0)%> - 搜索结果</td>
  </tr>
  <%
	if Not(rs.eof and rs.bof) then
%>
  <tr class="table-title"> 
    <td>标 题</td>
    <td width="120">作 者</td>
    <td width="150"  class="table-title">所属论坛</td>
    <td width="150"  class="table-title">发贴时间</td>
  </tr>
  <%
	rs.pageSize = 20
	page = trim(request.form("page"))
		if page = "" then page = trim(request.QueryString("page"))
		if Not(IsNumeric(page)) or page = "0" then page = 1
	pageCount = rs.pageCount
	if len(page) > 4 then page = pageCount
	if Cint(page) > Cint(pageCount) then page = pageCount
	rs.absolutepage = page
	for t = 1 to rs.pagesize
		if rs.eof then exit for
		posttitle = rs("posttitle")
		if key <> "" then
			posttitle = replace(posttitle,key,"<font color=red>"& key &"</font>")
		End if
%>
  <tr> 
    <td class="table-dark"><a href="showthread.asp?threadID=<%=rs("threadID")%>" target="_blank"><%=posttitle%></a></td>
    <td width="120" class="table-light"><a href="user.asp?userID=<%=rs("user_ID")%>" target="_blank"><%=rs("user_name")%></a></td>
    <td width="150" class="table-dark"><a href="Board.asp?BoardID=<%=rs("BoardID")%>" target="_blank"><%=rs("title")%></a></td>
    <td width="150" class="table-light"><%=rs("posttime")%></td>
  </tr>
  <%
	rs.MoveNext
	Next't
	else
%>
  <tr> 
    <td colspan="4" class="table-light">对不起,没有匹配的内容!</td>
  </tr>
  <%
	End if
%>
</table>
<table border="0" align="center" cellpadding="4" cellspacing="0" class="table-noColor">
  <tr>
    <td>
	<%
	if pagecount < 1 then pagecount = 1
	response.Write "&nbsp页次:"& PAGECOUNT &"/" & page &"页 每页"& rs.pageSize &" 贴子数"&rs.recordCount&" "
	%></td>
    <td height="30">分页: 
      <%
beginpage = 1
endpage = CInt(pagecount)
page = CInt(page)
if pagecount >= 9 then
	if page >= 5 then
		beginpage = page - 4
		if page <= (pagecount - 4) then
			endpage = page + 4
		else
			endpage = pagecount
			beginpage = pagecount - 4
		end if
	else
		beginpage = 1
		endpage = 9
	end if
end if

if beginpage>1 then response.write "&nbsp;<a title=""第一页"" href="""&pageurl&"""><font face=webdings>9</font></a>"
for j = beginpage to endpage
	if j = page then
		response.write"&nbsp;<b>[" & j & "]</b>&nbsp;"
	else
		response.write"<a href="""&pageurl&"&page=" & j &""">&nbsp;[" & j & "]&nbsp;</a>"
	end if
next
if endpage < pagecount then response.write "&nbsp;<a title=""最末页"" href="""&pageurl&"&page="& pagecount &"""><font face=webdings>:</font></a>"
%> </td><form name="form1" method="post" action="">
    <td><div align="right">转到:第 
        <input name="page" type="text" size="3" maxlength="5">   
        <input type="submit" name="Submit" value="页">
      </div></td></form>
  </tr>
</table>
<br>
<%'	response.Write(username)
	rs.close
	set rs = nothing
End if
'========================================
Call Bottom()
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -