?? talk_seek_result.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%">
<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>
</td>
</tr></table>
<table align="center" width="700" height="18" border="0" cellspacing="0" cellpadding="6" class="rde">
<tr><td width="100%">
<% =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 %>
查詢結果共<font color="<% =cohover %>"><% =rdcount %></font>篇 分為<font color="<% =cohover %>"><% =pgcount %></font>頁 每頁<font color="<% =cohover %>"><% =pgsize %></font>篇 第<font color="<% =cohover %>"><% =curpage %></font>頁
<%
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">
</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 + -