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

📄 search_exec.asp

📁 在线考试系统
💻 ASP
字号:
<%@ Language=VBScript %>

<% option explicit %>

<!-- #include file="conn_forum.asp" -->

<%

	dim areaname(100)

	dim iPage

	dim iSearch			'1-search	,2-hot		,3-recent
	dim iArea			'-1 ==== all area
	dim iKeyWord
	dim iRange			'1-all		,2-theme	,3-content
	dim iDay			'-1 ==== all


	iPage=Clng(Request("page"))
	iArea=Clng(Request("area"))
	iSearch=Clng(request("search"))
	iKeyWord=Request("keyWord")
	iRange=Clng(Request("range"))
	iDay=Clng(Request("day"))

	if iPage=0 then iPage =1
	if iSearch=0 then iSearch=2

	if iKeyWord="" and iSearch=1 then
		Response.Write "Please enter keyword!"
		Response.Write "<a href='#' onclick='history.back()'>BACK</a>"
		Response.End
	end if

	Const ListCount =25

	dim i
	Dim rs

	set rs=Server.CreateObject ("ADODB.Recordset")

	'------------------------------------\load area name
	rs.Open "SELECT areaid,areaname FROM tindex ORDER BY areaID",connf,1,1
	if rs.BOF and rs.EOF then
		Response.Write "No area!"
		Response.End
	else
		rs.MoveLast
		rs.MoveFirst
		do
			i=rs("areaid")
			areaname(i)=rs("areaname")
			rs.MoveNext
		loop until rs.EOF
	end if
	rs.Close
	'------------------------------------/load area name

	dim sFields
	sFields="ThemeID,ParentID,AreaID,Theme,Author,Date,Time,Hit,ReplyCount,Replier,Icon,lock,selected"

	if iSearch=1 then

		dim strTmp

		if iarea=-1 then
			strTmp="AreaId>0"
		else
			strTmp="AreaId=" & iarea
		end if

		if iDay=-1 then
			strTmp=strtmp & ""
		elseif iDay=0 then
			strTmp=strtmp & " AND Date=#" & date() & "#"
		else
			strTmp=strtmp & " AND date BETWEEN #" & DateAdd("d",-iDay,Date()) & "# AND #" & date() & "#"
		end if

		dim iKeyWord2
		iKeyWord2 = "%" & iKeyWord & "%"

		if iRange =1 then			'1-all		,2-theme	,3-content		,4-author
			strTmp =strTmp & " AND (Theme LIKE '" & iKeyWord2 & "' OR Content LIKE '" & iKeyWord2 & "')"
		elseif iRange=2 then
			strTmp =strTmp & " AND Theme LIKE '" & iKeyWord2 & "'"
		elseif iRange=3 then
			strTmp =strTmp & " AND Content LIKE '" & iKeyWord2 & "'"
		elseif iRange=4 then
			strTmp =strTmp & " AND Author ='" & iKeyWord & "'"
		end if

		rs.Open "SELECT " & sFields & " FROM tcontent WHERE " & strtmp & " ORDER BY Date DESC,Time DESC" ,connf,1,1

	elseif iSearch =2 then	'hot
		rs.Open "SELECT TOP 100 " & sFields & " FROM tcontent WHERE ParentID=-1 ORDER BY Hit DESC",connf,1 ,1

	elseif iSearch=3 then	'recent
		rs.Open "SELECT TOP 100 " & sFields & " FROM tcontent WHERE ParentID=-1 ORDER BY Date DESC,Time DESC",connf,1 ,1

	end if


	if rs.BOF and rs.EOF then
		'No Data!
	else
		rs.PageSize =ListCount
		if iPage>rs.PageCount then iPage=rs.PageCount
		rs.AbsolutePage=iPage
	end if

%>

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>论坛搜索结果</title>
<link rel="stylesheet" type="text/css" href="../main.css">
</head>

<body bgcolor="#FFFFFF">

<SCRIPT language=JavaScript src="../include/header.inc" type=text/javascript></SCRIPT>

<!-- #include file="inc_forumheader.asp" -->

<center>
<table border="0" width="760" cellspacing="1">
  <tr>
    <td width="100%" valign="bottom" align="center"><B>
		<%
		if iSearch=1 then
			Response.Write "搜索结果"
		elseif iSearch=2 then
			Response.Write "最HOT话题"
		elseif iSearch=3 then
			Response.Write "最新文章"
		end if
		%>
		</B>
    </td>
  </tr>
</table>

<p> </p>

<table border="0" width="760" bgcolor="#CCCCCC" cellspacing="1">
  <tr>
    <td width="33" bgcolor="#687088" align="center" height="25"> </td>
    <td width="213" bgcolor="#687088" align="center" height="25"><font color="#FFFFFF"><b>主题</b></font></td>
    <td width="96" bgcolor="#687088" align="center" height="25"><font color="#FFFFFF"><b>讨论区</b></font></td>
    <td width="71" bgcolor="#687088" align="center" height="25"><font color="#FFFFFF"><b>作者</b></font></td>
    <td width="124" bgcolor="#687088" align="center" height="25"><font color="#FFFFFF"><b>更新时间</b></font></td>
    <td width="48" bgcolor="#687088" align="center" height="25"><font color="#FFFFFF"><b>点击</b></font></td>
    <td width="52" bgcolor="#687088" align="center" height="25"><font color="#FFFFFF"><b>回复数</b></font></td>
    <td width="77" bgcolor="#687088" align="center" height="25"><font color="#FFFFFF"><b>回复者</b></font></td>
  </tr>

<%
	if rs.BOF and rs.EOF then
		Response.Write "<tr>"
		Response.Write "<td width='100%' bgcolor='#FFFBEE' height='22' colspan='8'>没有找到你要搜索的文章呀!</td>"
		Response.Write "</tr>"
	else

		'rs.MoveFirst
		for i=1 to ListCount

		if rs("ParentId")=-1 then
		%>
		<tr>
			<td width="33" bgcolor="#FFFBEE" height="22" align="center"><img border="0" src="images/titleicon/<%=rs("Icon")%>"></td>
			<td width="213" bgcolor="#FFFFFF" height="22"><a href="viewtheme.asp?area=<%=rs("areaid")%>&id=<%=rs("ThemeID")%>">
			<%		
			Response.Write rs("Theme") & "</a> "
			if rs("selected")=1 then
				Response.Write " <img src='images/topmost.gif' alt='顶端主题' border='0'>"
			end if
			
			if rs("Hit") >= 35 then
				Response.Write " <img src='images/hot.gif' alt='热门主题' border='0'>"
			end if
			%>
			</td>
			<td width="96" bgcolor="#FFFFFF" height="22"><a href="listtheme.asp?area=<%=rs("areaID")%>"><%=areaname(rs("areaid"))%> </a></td>
			<td width="71" bgcolor="#EFEFEF" height="22" align="center"><a href="viewinfo.asp?uid=<%=rs("Author")%>"><%=rs("Author")%></a></td>
			<td width="124" bgcolor="#FFFFFF" height="22"><%=rs("Date") & " " & rs("Time")%></td>
			<td width="48" bgcolor="#EFEFEF" height="22" align="center"><%=rs("Hit")%></td>
			<td width="52" bgcolor="#FFFFFF" height="22" align="center"><%=rs("ReplyCount")%></td>
			<td width="77" bgcolor="#EFEFEF" height="22" align="center"><a href="viewinfo.asp?uid=<%=rs("Replier")%>"><%=rs("Replier")%></a></td>
		</tr>
		<%
		else
		%>
		<tr>
			<td width="33" bgcolor="#FFFBEE" height="22"></td>
			<td width="213" bgcolor="#FFFFFF" height="22"><a href="viewtheme.asp?area=<%=rs("areaid")%>&id=<%=rs("ParentID")%>"><img border="0" src="images/post.gif" alt="打开回复的主题"><%=rs("Theme")%></a></td>
			<td width="96" bgcolor="#FFFFFF" height="22"><a href="listtheme.asp?area=<%=rs("areaID")%>"><%=areaname(rs("areaid"))%> </a></td>
			<td width="71" bgcolor="#EFEFEF" height="22" align="center"><a href="viewinfo.asp?uid=<%=rs("Author")%>"><%=rs("Author")%></a></td>
			<td width="124" bgcolor="#FFFFFF" height="22"><%=rs("Date") & " " & rs("Time")%></td>
			<td width="48" bgcolor="#EFEFEF" height="22" align="center"></td>
			<td width="52" bgcolor="#FFFFFF" height="22" align="center"></td>
			<td width="77" bgcolor="#EFEFEF" height="22" align="center"></td>
		</tr>
		<%
		end if

		rs.MoveNext
		if rs.EOF then exit for
		next
	end if
%>

</table>

<p align="center">页码:<%=iPage & "/" & rs.PageCount%></p>

<form method="POST" action="search_exec.asp">
  <table border="0" width="760" cellspacing="0" bgcolor="#F0F0F0">
	<tr>
		<td width="55%" align="left">

			<input type="hidden" name="area" value="<%=iarea%>">
			<input type="hidden" name="Search" value="<%=iSearch%>">
			<input type="hidden" name="KeyWord" value="<%=iKeyWord%>">
			<input type="hidden" name="Range" value="<%=iRange%>">
			<input type="hidden" name="day" value="<%=iday%>">
		</td>

		<td width="45%" align="right">
        <%
        if iPage<>1 then
			Response.Write "<a href='search_exec.asp?area=" & iArea & "&search=" & iSearch & "&range=" & irange & "&day=" & iday & "&Keyword=" & iKeyWord & "&page=" & "1" & "'>第一页</a> | "
			Response.Write "<a href='search_exec.asp?area=" & iArea & "&search=" & iSearch & "&range=" & irange & "&day=" & iday & "&Keyword=" & iKeyWord & "&page=" & ipage-1 & "'>前一页</a> | "

			'Response.Write "<a href='listtheme.asp?area=" & iArea & "&lstSort=" & iSort & "&lstDay=" & iDay & "&page=1" & "'>第一页</a> | "
			'Response.Write "<a href='listtheme.asp?area=" & iArea & "&lstSort=" & iSort & "&lstDay=" & iDay & "&page=" & iPage-1 & "'>前一页</a> | "
		else
			Response.Write "<font color='#AAAAAA'>第一页</font> | "
			Response.Write "<font color='#AAAAAA'>前一页</font> | "
		end if

		if iPage<>rs.PageCount then
			Response.Write "<a href='search_exec.asp?area=" & iArea & "&search=" & iSearch & "&range=" & irange & "&day=" & iday & "&Keyword=" & iKeyWord & "&page=" & ipage+1 & "'>后一页</a> | "
			Response.Write "<a href='search_exec.asp?area=" & iArea & "&search=" & iSearch & "&range=" & irange & "&day=" & iday & "&Keyword=" & iKeyWord & "&page=" & rs.PageCount  & "'>最后一页</a> | "

			'Response.Write "<a href='listtheme.asp?area=" & iArea & "&lstSort=" & iSort & "&lstDay=" & iDay & "&page=" & ipage+1 & "'>后一页</a> | "
			'Response.Write "<a href='listtheme.asp?area=" & iArea & "&lstSort=" & iSort & "&lstDay=" & iDay & "&page=" & rs.PageCount  & "'>最后一页</a> | "
		else
			Response.Write "<font color='#AAAAAA'>后一页</font> | "
			Response.Write "<font color='#AAAAAA'>最后一页</font> | "
		end if
        %>
        &nbsp;转到第 <input type="text" name="page" size="4" style="background-color: #FFFBEE; border: 1 solid #FF9933" value="<%=iPage%>"> 页
		</td>

		</tr>
	</table>
</form>

</center>


<p> </p>

<SCRIPT language="JavaScript" src="../include/buttom.inc" type="text/javascript"></SCRIPT>

</body>

<%
	rs.Close
	set rs=nothing
	call closeconnf()
%>

</html>

⌨️ 快捷键说明

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