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

📄 search.asp

📁 这是ASP的OA
💻 ASP
字号:
<!-- #include file="const.asp" -->
<%
call opendb()
checkuser()
dim page,sql,rs,keyword,type1,where1,rs2
dim totalcount,totalpages,psize,i,id
psize=20
page=trim(request("page"))
keyword=trim1(request("keyword"))
type1=trim1(request("type"))
where1=trim1(request("where"))
if page="" then
	page=1
else page=cint(page)
	if page<=0 then
	page=1
	end if
end if
if type1<>"2" then type1="1"
position "帖子搜索",0
%>
<html>
<head>
<title><%=sitename%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="10" align="center" valign="top"> <!-- #include file="topbar.asp" --> </td>
  </tr>
  <tr> 
    <td align="center" valign="top"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="12" bgcolor="#ECE9D9">&nbsp;</td>
          <td width="1" bgcolor="#E8BC3C"></td>
          <td width="10">&nbsp;</td>
          <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="3">
              <tr> 
                <td width="100%" height="26"><span class="v8"><img src="images/btn_face.gif" width="10" height="7"> 
                  <a href="index.asp"><%=sitename%></a> <FONT face=Webdings color="#660000">8</FONT> 
                  </span><span class="v7b">搜索结果</span></td>
              </tr>
              <tr> 
                <td height="1" bgcolor="#ECE9D9"></td>
              </tr>
            </table>
            <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="12"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td width="130" height="16" bgcolor="#A0AB6D">&nbsp;<span class="v8b">&nbsp;<img src="images/fang-1.gif" align="absmiddle"> 
                        </span><span class="v7"><font color="#FFFFFF">帖子搜索</font></span></td>
                      <td height="16" nowrap bgcolor="#CCCCCC" class="v8b">&nbsp;</td>
                    </tr>
                  </table>
                  <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
                    <tr bgcolor="#FFFFFF"> 
                      <td valign="top" class="v7"><table border="0" cellspacing="0" cellpadding="0" width=400>
                          <form name="schform" method="post" action="search.asp">
                            <tr> 
                              <td nowrap> 关键词: 
                                <input name="keyword" type="text" class=input1 id="keyword" value="<%=keyword%>" size="10" maxlength="30"> 
                                &nbsp;&nbsp;类别: 
                                <select name="type" id="type" class="input1">
                                  <option value="1" <%if type1="1" then response.Write("selected")%>>标题</option>
                                  <option value="2" <%if type1="2" then response.Write("selected")%>>作者</option>
                                </select> &nbsp;&nbsp;范围: 
                                <select name="where" class="select" id="where">
                                  <%
					  dim tmprs1,tmprs2,tmpcid,tmpsql
					  tmpsql="select * from m3_category where CValid=1 order by CIndex asc"
					  set tmprs1=server.CreateObject("adodb.recordset")
					  set tmprs2=server.CreateObject("adodb.recordset")
					  tmprs1.open tmpsql,conn,1,1
					  do while not tmprs1.eof
					  		response.write("<option value="""&tmprs1("CID")&""">"&tmprs1("CTitle")&"</option>")
							tmpsql="select FID,FTitle from m3_forum where CID="&tmprs1("CID")&" and FValid=1 order by FIndex asc"
							tmprs2.open tmpsql,conn,1,1
							do while not tmprs2.eof
								response.write("<option value="""&tmprs2("FID")&""">&nbsp;&nbsp;- "&tmprs2("FTitle")&"</option>")
								tmprs2.movenext
							loop
							tmprs2.close
							tmprs1.movenext
					  loop
					  tmprs1.close
					  set tmprs1=nothing
					  set tmprs2=nothing
						%>
                                </select> <input name="imageField" type="image" src="images/sch1.gif" align="middle" width="16" height="14" border="0"> 
                                &nbsp; </td>
                            </tr>
                          </form>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td height="2" bgcolor="#ECE9D9"></td>
                    </tr>
                  </table></td>
              </tr>
            </table>
            <br> <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="12"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td width="130" height="12" bgcolor="#990000">&nbsp;<span class="v8b">&nbsp;<img src="images/fang-1.gif" align="absmiddle"> 
                        </span><span class="v7"><font color="#FFFFFF">搜索结果</font></span></td>
                      <td height="12" nowrap bgcolor="#CCCCCC" class="v8b">&nbsp;</td>
                    </tr>
                  </table>
                  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
                    <tr bgcolor="#FFFFFF"> 
                      <td valign="top" class="v7"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#DCD6BA">
                          <tr> 
                            <td width="32" background="images/bg4.gif" bgcolor="#ECE9D9">&nbsp;</td>
                            <td width="401" background="images/bg4.gif" bgcolor="#ECE9D9">主题</td>
                            <td width="86" align="center" background="images/bg4.gif" bgcolor="#ECE9D9">作者</td>
                            <td width="122" align="center" background="images/bg4.gif" bgcolor="#ECE9D9">所在论坛</td>
                            <td width="130" align="center" background="images/bg4.gif" bgcolor="#ECE9D9">发表时间</td>
                          </tr>
<%
'if where1="" then where1="0"
if keyword <>"" then
	if type1="1" then
		if where1="" then
			sql="select bbs.topic,bbs.name,bbs.face,bbs.FID,bbs.addtime,bbs.id,forum.ftitle from m3_bbs as bbs,m3_forum as forum where ((bbs.topic like '%"&keyword&"%') and (bbs.valid=1) and (forum.FID=bbs.FID)) order by bbs.addtime desc"
		else
			sql="select bbs.topic,bbs.name,bbs.face,bbs.FID,bbs.addtime,bbs.id,forum.ftitle from m3_bbs as bbs,m3_forum as forum where ((bbs.topic like '%"&keyword&"%') and (bbs.CID="&where1&" or bbs.FID="&where1&") and (bbs.valid=1) and (forum.FID=bbs.FID)) order by bbs.addtime desc"
		end if
	else
		if where1="" then
			sql="select bbs.topic,bbs.name,bbs.face,bbs.FID,bbs.addtime,bbs.id,forum.ftitle from m3_bbs as bbs,m3_forum as forum where ((bbs.name like '%"&keyword&"%') and (bbs.valid=1) and (forum.FID=bbs.FID)) order by bbs.addtime desc"
		else
			sql="select bbs.topic,bbs.name,bbs.face,bbs.FID,bbs.addtime,bbs.id,forum.ftitle from m3_bbs as bbs,m3_forum as forum where ((bbs.name like '%"&keyword&"%') and (bbs.CID="&where1&" or bbs.FID="&where1&") and (bbs.valid=1) and (forum.FID=bbs.FID)) order by bbs.addtime desc"
		end if
	end if
	set rs=server.CreateObject("ADODB.RecordSet")
	rs.open sql,conn,1,1
	if not (rs.bof and rs.eof) then
		rs.pagesize=psize
		rs.cachesize=rs.pagesize
		totalpages=rs.pagecount
		if page>rs.pagecount then page=rs.pagecount
		rs.absolutepage=page
		totalcount=int(rs.recordcount)
		i=0
		do while (not rs.eof) and (i<psize)
			i=i+1
			id=rs("ID")
			
	%>
                          <tr bgcolor="#FFFFFF" height="20"> 
                            <td height="24" align="center"> <img src="images/f<%=trim(rs("face"))%>.gif"></td>
                            <td height="24"> <a href="treelist.asp?id=<%=id%>" target="_blank">&nbsp;<%=rs("topic")%></a></td>
                            <td height="24" align="center" bgcolor="#F1F3D6"> 
                              <a href='profile.asp?name=<%=rs("name")%>' target="_blank"><%=rs("name")%></a></td>
                            <td height="24" align="center" bgcolor="#FFFFFF"><a href="list.asp?forumid=<%=rs("FID")%>" target="_blank"><%=rs("ftitle")%></a></td>
                            <td height="24" align="center" bgcolor="#FFFFFF"> 
                              <%=rs("addtime")%></td>
                          </tr>
                          <%
			rs.movenext
		loop
	else
		response.Write("<tr><td colspan=5 bgcolor=#FFFFFF height=30>&nbsp;&nbsp;没有找到任何信息,可以尝试简化关键词,重新搜索  ... </td></tr>")
	end if
	rs.close
	set rs=nothing
else
	response.Write("<tr><td colspan=5 bgcolor=#FFFFFF height=30>&nbsp;&nbsp;请输入关键词,进行搜索  ... </td></tr>")
end if
call closedb()
%>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td height="2" bgcolor="#ECE9D9"></td>
                    </tr>
                  </table></td>
              </tr>
            </table>
            <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td><img src="images/blank.gif" width="1" height="2"></td>
              </tr>
            </table>
            <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td> <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
                    <tr bgcolor="#FFFFFF"> 
                      <td valign="top" class="v7"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F1F0E4">
                          <form name="pageform" method="post" action="search.asp?keyword=<%=keyword%>&type=<%=type1%>&where=<%=where1%>">
                            <tr> 
                              <td><span class="v7">&nbsp;&nbsp;帖子数:<%=totalcount%> 
                                &nbsp;&nbsp;总页数:<%=totalpages%>&nbsp;&nbsp;&nbsp; 
                                | 
                                <%if page>1 then
										response.write("<a href='search.asp?keyword="&keyword&"&type="&type1&"&where="&where1&"'>首页</a>")
									else
										response.write("首页")
									end if
									%>
                                | 
                                <%if page>1 then
										response.write("<a href='search.asp?keyword="&keyword&"&type="&type1&"&where="&where1&"&page="&page-1&"'>前一页</a>")
									else
										response.write("前一页")
									end if
									%>
                                | 
                                <%if page<totalpages then
										response.write("<a href='search.asp?keyword="&keyword&"&type="&type1&"&where="&where1&"&page="&page+1&"'>下一页</a>")
									else
										response.write("下一页")
									end if
									%>
                                | 
                                <%if page<totalpages then
										response.write("<a href='search.asp?keyword="&keyword&"&type="&type1&"&where="&where1&"&page="&totalpages&"'>末页</a>")
									else
										response.write("末页")
									end if
									%>
                                | 
                                <%if totalpages>3 then%>
                                &nbsp;&nbsp; 跳到:第 
                                <select name="page" class="input1" id="page" onChange="this.form.submit()">
                                  <%for i=1 to totalpages
											response.write "<option value="&i&""
											if i=page then response.write" selected"
											response.write">"&i&"</option>"&chr(13)
										next
										%>
                                </select>
                                <%end if%>
                                </span></td>
                            </tr>
                          </form>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td height="2" bgcolor="#ECE9D9"></td>
                    </tr>
                  </table></td>
              </tr>
            </table>
            <br> <i></i> </td>
          <td width="10">&nbsp;</td>
          <td width="1" bgcolor="#E8BC3C"></td>
          <td width="100" bgcolor="#ECE9D9" valign="top">  
            <!-- #include file="right.asp" -->
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td height="10" align="center" valign="bottom"> 
      <!-- #include file="bottombar.asp" -->
    </td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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