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

📄 search.asp

📁 一个不错的论坛原代码
💻 ASP
📖 第 1 页 / 共 2 页
字号:
        for i=0 to ubound(key1)
        sql=sql&" topic.t_username like '%"&key1(i)&"%' or"
        next
        sql=left(sql,len(sql)-3)
           else
       sql=sql &" topic.t_username like '%"&key&"%'"  
        end if
        sql=sql&" )"
        
        
        end if

elseif title=3 or title=4 then
sql="select top 1000 topic.t_username,topic.t_id,topic.l_id,topic.t_replynum,topic.t_lastusername,topic.t_title from topic,reply  where topic.t_lock<>2 and topic.t_id=reply.t_id and"
 sql=sql&" (" 
       if ubound(key1)>0 then     
        for i=0 to ubound(key1)
        sql=sql&" reply.r_title like '%"&key1(i)&"%'"
        if title=4 then   sql=sql &" or reply.r_content like '%"&key1(i)&"%'"
        sql=sql&" or" 
        next
        sql=left(sql,len(sql)-3)
           else
             sql=sql&" reply.r_title like '%"&key&"%'"
        if title=4 then  sql=sql &" or reply.r_content like '%"&key&"%'"        
        end if
        sql=sql&" )" 
        elseif title=6 then
        sql="select top 1000 topic.t_username,topic.t_id,topic.l_id,topic.t_replynum,topic.t_lastusername,topic.t_title from topic,reply  where topic.t_lock<>2 and topic.t_id=reply.t_id and (topic.t_username like '%"&key&"%' or reply.r_username like '%"&key&"%')"
        else
        sql="select top 1 t_username from topic where t_username='cpbfy'"
        end if
       if sdate<>0 then   sql=sql&" and t_time>#"&dateadd("d", -sdate, nowtime) & "#"   
          if lanmu<>"0" and (title=6 or title=3 or title=4 )then  
          sql=sql &" and topic.l_id="&lanmu&""    
          elseif lanmu<>"0" then
          sql=sql &" and l_id="&lanmu&""  
          end if
        
rs.open sql,conn,1,1
if not(rs.BOF or rs.EOF) then
r=cint(rs.RecordCount)'记录总数

	if r mod pages=0 then
     		maxpagecount= r \ pages
  	else
     		maxpagecount= r \ pages+1
  	end if
 
	RS.MoveFirst
	if int(page) > maxpagecount then page = maxpagecount
   	if int(page)<1 then page=1
	RS.Move (page-1) * pages
	rcount=0

 %>       
           <tr  align="center" height=23> 
            <td width="15%" <%=tColor%> class=tdc1>作者</td>
            <td width="40%" <%=tColor%> class=tdc1>主题</td>
            <td width="10%" <%=tColor%> class=tdc1>回复数</td>
            <td width="15%" <%=tColor%> class=tdc1>最新回复</td>
          </tr>
 
<% do while not rs.eof and rcount <int(Pages)%> 

       <tr  align="center" height=23> 
            <td width="15%" bgcolor=<%=tColor2%> class=tdc><a href="viewuser.asp?username=<%=rs("t_username")%>" target=_blank><%=rs("t_username")%></a> </td>
            <td width="40%" bgcolor=<%=tColor2%> class=tdc><a href=topic.asp?l_id=<%=rs("l_id")%>&t_id=<%=rs("t_id")%> title=<%=HTMLEncode(rs("t_title"))%>><%=gao(left(HTMLEncode(rs("t_title")),30))%>...</a> </td>
            <td width="10%" bgcolor=<%=tColor2%> class=tdc><%=rs("t_replynum")%> </td>
            <td width="15%" bgcolor=<%=tColor2%> class=tdc><%=rs("t_lastusername")%> </td>
          </tr>

<% 

rs.MoveNext 
rcount=rcount+1
loop 
set rs=nothing 
%> 
<tr  align="center" height=23> 
            <td colspan="7" bgcolor=<%=tColor2%> class=tdc >

 <%
pagestart=page-5
pageend=page+5
if pagestart<1 then pagestart=1
if pageend>maxpagecount then pageend=maxpagecount
response.write(" [ ")
if maxpagecount > 6 then Response.Write ("<a href=?action=search&key="&key&"&sdate="&sdate&"&lanmu="&lanmu&"&title="&title&"&page=1>1</a> ... ")
for i=pagestart to pageend
if i<>int(page) then
Response.Write (" <a href=?action=search&key="&key&"&sdate="&sdate&"&lanmu="&lanmu&"&title="&title&"&page="&i&">" & i & "</a> ")
else
Response.Write ("<b>"&i&"</b> ")
end if
next
if maxpagecount > page +5 then Response.Write( " ... <a href=?action=search&key="&key&"&sdate="&sdate&"&lanmu="&lanmu&"&title="&title&"&page="&maxpagecount&">"&maxpagecount&"</a>")
response.write(" ] ")
response.write("..页次:"&page&"/"&maxpagecount&"页   每页:"&pages&" 记录数:"&r&"  ")%>  </td></tr>          
          <%else
            errormsg="<li>找不到你要的结果,<a href=""javascript:history.go(-1)"">请返回</a>重新搜索</li>"
          call error(errormsg) 
          end if%>
         
           <% elseif key = "" and username ="" then 
            errormsg="<li>请输入关键字查找,<a href=""javascript:history.go(-1)"">请返回</a>重新搜索</li>"
          call error(errormsg) 
          end if%>
           </table>



   <% Elseif Request.QueryString("action")="" then%>


  <table border=0 borderColor=<%=tdc2%> cellPadding=0 cellSpacing=0 width=<%=tdc3%> style="border-collapse: collapse" align=center>
   <form name="form1" method="post" action="search.asp?action=search"><tr> 
      <td > 
       <table border=1 borderColor=<%=tdc2%> cellPadding=4 cellSpacing=1 width=100% style="border-collapse: collapse">        
          <tr  align="center" height=23> 
            <td colspan="2" <%=tColor%> class=tdc1 height="22">搜索论坛中的帖子</td>
          </tr>
          <tr > 
            <td width="40%" align="right" bgcolor=<%=tcolor2%> class=tdc height="23">你要搜索的关键字:</td>
            <td width="60%" bgcolor=<%=tcolor2%> class=tdc height="23"> 
              &nbsp;<input type="text" name="key" class="bdtj3" size="32">(多个关键字请用|分开)
            </td>
          </tr>
          <tr > 
            <td width="40%" align="right" bgcolor=<%=tcolor2%> class=tdc height="23">选择需要搜索的论坛:</td>
            <td width="60%" bgcolor=<%=tcolor2%> class=tdc height="23"> 
              &nbsp;<select name="lanmu" class="bdtj3">
                <option value="0">----所有论坛----</option>
                <% sqlfen="select f_id,f_title from fenlei order by f_num asc"
set rsfen=conn.execute(sqlfen)
do while not rsfen.eof%>
<option value="0">++<%=rsfen("f_title")%>++</option>
                <%sql_lanmu1="select * from lanmu where f_id="&rsfen("f_id")&""
set rs_lanmu1=conn.execute(sql_lanmu1)
%>
               <% do while not rs_lanmu1.Eof %>
      
      <option value=<%=rs_lanmu1("l_id")%>>&nbsp;&nbsp;├<%=rs_lanmu1("l_title")%></option>
      
      <%rs_lanmu1.MoveNext 
        Loop
        set rs_lanmu1=nothing
       
        rsfen.movenext
			loop
			set rsfen=nothing
			 set rslanmu=nothing%>  </select>(如果选择带+的,相当于选择所有论坛)
                     </td>
          </tr>
          <tr > 
            <td width="40%" align="right" bgcolor=<%=tcolor2%> class=tdc height="23">选择搜索范围:</td>
            <td width="60%" bgcolor=<%=tcolor2%> class=tdc height="23"> 
              &nbsp;<select name="title" class="bdtj3">
                <option value="1">所有主题帖标题</option>
                <option value="2">主题作者</option>
                <option value="3">所有回复贴标题</option>
                <option value="4">所有回复标题与内容</option>
                <option value="6">主题或者回复作者</option>
              </select>
            </td>
          </tr>
               <tr > 
            <td width="40%" align="right" bgcolor=<%=tcolor2%> class=tdc height="23">选择搜索时间:</td>
            <td width="60%" bgcolor=<%=tcolor2%> class=tdc height="23"> 
              &nbsp;<select name="sdate" class="bdtj3">
             <OPTION value="0">所有日期
<OPTION VALUE="1">昨天至今
<OPTION VALUE="7" SELECTED>最近一周
<OPTION VALUE="14">最近两周
<OPTION VALUE="30">最近30天
<OPTION VALUE="365">最近365天
              </select>
            </td>
          </tr>
          <tr > 
            <td width="40%" align="right" bgcolor=<%=tcolor2%> class=tdc height="23">
            搜索用户:</td>
            <td width="60%" bgcolor=<%=tcolor2%> class=tdc height="23"> 
              &nbsp;<input type="text" name="username" class="bdtj3" size="20">(多个关键字请用|分开)
            </td>
          </tr>
          <tr > 
            <td width="40%" align="right" bgcolor=<%=tcolor2%> class=tdc> </td>
            <td width="60%" bgcolor=<%=tcolor2%> class=tdc> 
              <input type="submit" name="Submit" value=" 开 始 搜 索 " class="bdtj">
            </td>
          </tr>
        </table>
      </td>
    </tr></form>
  </table>
  <%end if%>
  <%end if%><!--#include file="bq.asp" -->

⌨️ 快捷键说明

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