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

📄 talk_seek_result.asp

📁 一个超级漂亮的班级主页asp代码
💻 ASP
字号:
<!--插入html头部分以及数据库接口-->
<!--#include file="in_conn.asp"-->


<body>


<!--插入网站置顶-->
<% if u_name="" then
	Response.Redirect "log_err.asp"
else
%>
<!--#include file="in_topmb.asp"-->
<% end if %>


<%
'获取传值
dim sqlseek,vstopic,vsauthor,tipseek
vstopic=""
vsauthor=""
sqlseek=""
tipseek="以下列出:"
dim vskind

If Request.QueryString("page")="" Then
		IF trim(Request.QueryString("username"))="" THEN
			vstopic=trim(Request.Form("txttopic"))
			vsauthor=trim(Request.Form("txtauthor"))
			vskind=Request.Form("txtkind")
				if vstopic="" AND vsauthor="" then
					Response.Redirect("resp.asp?cmd=seeknotkey")
				else
						if vstopic<>"" then
							sqlseek=sqlseek&" AND t.t_topic LIKE '%"&stryin(vstopic)&"%' "
							tipseek=tipseek&"主题关键字“<font class=ft1>"&unhtml(vstopic)&"</font>” "
						end if
						if vsauthor<>"" then
							sqlseek=sqlseek&" AND t.t_author LIKE '%"&stryin(vsauthor)&"%' "
							tipseek=tipseek&"作者“<font class=ft1>"&vsauthor&"</font>” "
						end if
						if isNumeric(vskind) then
							vskind=CLng(vskind)
							sqlseek=sqlseek&" AND t.t_kind="&vskind&" "
							vskindname=conn.Execute("SELECT kd_name FROM tblkind WHERE kd_ID="&vskind,0,1)(0)
							tipseek=tipseek&"版面“<font class=ft1>"&vskindname&"</font>” "
						else
							vskind=""
						end if
				end if
		ELSE
			vsauthor=trim(Request.QueryString("username"))
			sqlseek=sqlseek&" AND t.t_author='"&stryin(vsauthor)&"' "
			tipseek=tipseek&"作者“<font class=ft1>"&vsauthor&"</font>” "
		END IF
Else
			vstopic=trim(Request.QueryString("topic"))
			vsauthor=trim(Request.QueryString("username"))
			vskind=Request.QueryString("kind")
			if isNumeric(vskind) then
				vskind=CLng(vskind)
			else
				vskind=""
			end if
				if vstopic="" AND vsauthor="" then
					Response.Redirect("resp.asp?cmd=seeknotkey")
				else
						if vstopic<>"" then
							sqlseek=sqlseek&" AND t.t_topic LIKE '%"&stryin(vstopic)&"%' "
							tipseek=tipseek&"主题关键字“<font class=ft1>"&unhtml(vstopic)&"</font>” "
						end if
						if vsauthor<>"" then
							sqlseek=sqlseek&" AND t.t_author LIKE '%"&stryin(vsauthor)&"%' "
							tipseek=tipseek&"作者“<font class=ft1>"&vsauthor&"</font>” "
						end if
						if isNumeric(vskind) then
							vskind=CLng(vskind)
							sqlseek=sqlseek&" AND t.t_kind="&vskind&" "
							vskindname=conn.Execute("SELECT kd_name FROM tblkind WHERE kd_ID="&vskind,0,1)(0)
							tipseek=tipseek&"版面“<font class=ft1>"&vskindname&"</font>” "
						end if
				end if

End If
%>



<table align="center" width="700" height="25" border="0" cellspacing="0" cellpadding="0" class="rdbar"><tr>
	<td width="100%" height="60%">
		&nbsp;<a href="index.asp">[首页]</a>-<a href="talkbook.asp">[班级讨论区]</a>-<font class="ft1">[搜索结果]</font>
	</td>
	<td align="right">
		<a href="talk_seek.asp"><img src="img/seek.gif" border="0" hspace="0" vspace="0" align="absmiddle"></a>&nbsp;
	</td>
</tr></table>


<table align="center" width="700" height="18" border="0" cellspacing="0" cellpadding="6" class="rde">
	<tr><td width="100%">
	&nbsp;<% =tipseek %>的相关文章
	</td></tr>
</table>

<%
'分页的统计
dim rdcount,pgcount,pgsize
pgsize=20
rdcount=conn.Execute("SELECT COUNT(t.t_ID) FROM(SELECT m.ID,m.name,m.sex,m.power,t.t_ID,t.t_author,t.t_topic,t.t_datepub,t.t_datefre,t.t_class,t.t_re,t.t_clk,t.t_emotion,t.t_lastre,t.t_kind FROM tblmates AS m INNER JOIN tbltalk AS t ON m.name=t.t_author WHERE t.t_isreply=False"&sqlseek&")",0,1)(0)
if rdcount<1 then
	Response.Redirect("resp.asp?cmd=seeknotfound")
end if


pgcount=Abs(Int(rdcount/pgsize*(-1)))

'获取传值
dim curpage
curpage=Request.QueryString("page")

IF isNumeric(Request.QueryString("page")) THEN
	curpage=CLng(curpage)
	if curpage<1 OR curpage>pgcount then
		curpage=1
	end if
ELSE
	curpage=1
END IF

%>

<%
dim colnum,colmid,pg_i
'定义显示快捷页个数
colnum=5
colmid=colnum\2
'生成快捷页的函数
Sub PageQuick()
%>

<% if rdcount>0 then %>
<a href="talk_seek_result.asp?kind=<% =vskind %>&topic=<% =vstopic %>&username=<% =vsauthor %>&page=1"><font face="webdings" title="头页">9</font></a>
<% else %>
<font face="webdings" title="头页">9</font>
<% end if %>

<% If curpage>1 Then %>
<a href="talk_seek_result.asp?kind=<% =vskind %>&topic=<% =vstopic %>&username=<% =vsauthor %>&page=<% =curpage-1 %>"><font face="webdings" title="上页">7</font></a>
<% Else %>
<font face="webdings" title="上页">7</font>
<% End if %>

<%
'前省略号的使用
if pgcount>colnum AND curpage-colmid>1 then
	Response.Write "…"
end if

IF pgcount<colnum THEN
	for pg_i=1 to pgcount
		if pg_i<>curpage then
			response.write "<a href=talk_seek_result.asp?kind="&vskind&"&topic="&vstopic&"&username="&vsauthor&"&page="&pg_i&">["&pg_i&"]</a>"
		else
			response.Write "["&pg_i&"]"
		end if
	next
ELSEIF curpage-1>=colmid AND pgcount-curpage>=colmid THEN
	for pg_i=curpage-colmid to curpage+colmid
		if pg_i<>curpage then
			response.write "<a href=talk_seek_result.asp?kind="&vskind&"&topic="&vstopic&"&username="&vsauthor&"&page="&pg_i&">["&pg_i&"]</a>"
		else
			response.Write "["&pg_i&"]"
		end if
	next
ELSEIF curpage-1>=colmid AND pgcount-curpage<colmid THEN
	for pg_i=pgcount-colnum+1 to pgcount
		if pg_i<>curpage then
			response.write "<a href=talk_seek_result.asp?kind="&vskind&"&topic="&vstopic&"&username="&vsauthor&"&page="&pg_i&">["&pg_i&"]</a>"
		else
			response.Write "["&pg_i&"]"
		end if
	next
ELSE
	for pg_i=1 to 5
		if pg_i<>curpage then
			response.write "<a href=talk_seek_result.asp?kind="&vskind&"&topic="&vstopic&"&username="&vsauthor&"&page="&pg_i&">["&pg_i&"]</a>"
		else
			response.Write "["&pg_i&"]"
		end if
	next
END IF

'后省略号的使用
if pgcount>colnum AND curpage+colmid<pgcount then
	Response.Write "…"
end if
%>

<% If curpage<pgcount Then %>
<a href="talk_seek_result.asp?kind=<% =vskind %>&topic=<% =vstopic %>&username=<% =vsauthor %>&page=<% =curpage+1 %>"><font face="webdings" title="下页">8</font></a>
<% Else %>
<font face="webdings" title="下页">8</font>
<% End if %>

<% if rdcount>0 then %>
<a href="talk_seek_result.asp?kind=<% =vskind %>&topic=<% =vstopic %>&username=<% =vsauthor %>&page=<% =pgcount %>"><font face="webdings" title="尾页">:</font></a>
<% else %>
<font face="webdings" title="尾页">:</font>
<% end if %>

&nbsp;查询结果共<font color="<% =cohover %>"><% =rdcount %></font>篇&nbsp;分为<font color="<% =cohover %>"><% =pgcount %></font>页&nbsp;每页<font color="<% =cohover %>"><% =pgsize %></font>篇&nbsp;第<font color="<% =cohover %>"><% =curpage %></font>页&nbsp;
<%
End Sub
%>

<table align="center" width="700" height="25" border="0" cellspacing="0" cellpadding="0" style="background-color:<% =bg3 %>;">
	<tr>
		<td width="130" height="100%">

		</td>
		<td align="right">
			<% call PageQuick() %>
		</td>
	</tr>
</table>

<table align="center" width="700" height="25" border="0" cellspacing="0" cellpadding="0">
<tr><td width="100%" height="25">
	<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="rdbar">
	<tr>
		<th width="25" height="100%" class="rdr">&nbsp;
			
		</th>
		<th width="280" class="rdr" style="padding-left:4px; padding-right:4px; background:<% =bg1 %>">
			主 题
		</th>
		<th width="140" align="center" class="rdr">
			作 者
		</th>
		<th width="90" align="center" class="rdr" style="background:<% =bg1 %>">
			回复/点击
		</th>
		<th style="padding-left:12px;">
			最后发表
		</th>
	</tr>
	</table>
</td></tr>

<%
IF rdcount<1 THEN
%>
<tr><th width="100%" class="rdkuang"><font class="ft1">抱歉,没有任何相关文章!</font></th></tr>

<%
ELSE

sqlstr="SELECT m.ID,m.name,m.sex,m.power,t.t_ID,t.t_author,t.t_topic,t.t_datepub,t.t_datefre,t.t_class,t.t_re,t.t_clk,t.t_emotion,t.t_lastre,t.t_kind FROM tblmates AS m INNER JOIN tbltalk AS t ON m.name=t.t_author WHERE t.t_isreply=False"&sqlseek&" ORDER BY t.t_class DESC,t.t_idfre DESC"
rs.open sqlstr,conn,1,1

'给分页所需的中间变量赋值
rs.PageSize=pgsize

'当前页转到指定的页码
	rs.AbsolutePage=curpage

'开始读取数据
dim icn_top,icn_sex,vlastre,vlink,vttype
FOR i=1 to pgsize
		If rs.eof Then
			EXIT FOR
		End If
		'判断主题级别和表情
			if rs("t_emotion")=0 or rs("t_class")<2 then
				icn_top="img/topic/"&rs("t_emotion")&".gif"
			else
				icn_top="img/icn_top.gif"
			end if
		IF rs("t_class")>1 THEN
			vlink="class='ccjh'"
		ELSE
			vlink=""
		END IF
		'判断是否为投票主题
		
		IF rs("t_emotion")=0 THEN
			vttype="voteview.asp"
		ELSE
			vttype="talkview.asp"
		END IF

		'判断身份或者性别
		IF rs("power")>1 THEN
				icn_sex="img/icn_adm1.gif"
		ELSEIF rs("sex")=True THEN
				icn_sex="img/icn_gg.gif"
		ELSE
				icn_sex="img/icn_mm.gif"
		END IF
		'总管判断
		if DEF_sysadm=rs("name") then
			icn_sex="img/icn_admsys.gif"
		end if

		'最后发表的人
		IF isNULL(rs("t_lastre")) OR rs("t_lastre")="" THEN
			vlastre="------"
		ELSE
			vlastre=rs("t_lastre")
		END IF

%>

<tr><td width="100%" height="42">
	<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="rde">
	<tr>
		<th width="25" height="100%" class="rdr">
			<img src="<% =icn_top %>" border="0">
		</th>
		<td width="280" class="rdr" style="padding-left:4px; padding-right:4px; background:<% =bg3 %>">
			<a <% =vlink %> href="<% =vttype %>?id=<% =rs("t_ID") %>" title="主题:<% =stryin2(KillHTMLLabel(rs("t_topic"))) %><br>作者:<% =rs("t_author") %><br>发布于:<% =rs("t_datepub") %>"><% =unhtml(hhstr(rs("t_topic"),40)) %></a>
		</td>
		<td width="140" align="center" class="rdr">
			<img src="<% =icn_sex %>" border="0" align="absmiddle">
			<a href="viewinfo.asp?id=<% =rs("ID") %>" title="点击查看该同学详细资料"><% =rs("t_author") %></a>
		</td>
		<td width="90" align="center" class="rdr" style="background:<% =bg3 %>">
			<%
			Response.Write "<FONT class='ft1'>"&rs("t_re")&"</FONT>/"&rs("t_clk")
			%>
		</td>
		<td style="padding-left:12px;">
			<%
			IF isNULL(rs("t_datefre")) THEN
				Response.Write rs("t_datepub")
			ELSE
				Response.Write rs("t_datefre")
			END IF
			Response.Write "<br>"&vlastre
			%>
		</td>
	</tr>
	</table>
</td></tr>

<%
		rs.MoveNext
Next
rs.close

END IF
%>
</table>

<table align="center" width="700" height="25" border="0" cellspacing="0" cellpadding="0" style="background-color:<% =bg3 %>;">
	<tr>
		<td width="130" height="100%">

		</td>
		<td align="right">
			<% call PageQuick() %>
		</td>
	</tr>
</table>



<!--插入在线统计-->
<!--#include file="in_online.asp"-->
<!--插入网站置底-->
<!--#include file="in_bottom.asp"-->
</body>

</html>

⌨️ 快捷键说明

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