www.gusucode.com > ASP+ACCESS中学网站设计与实现(论文+源代码+开题报告+任务书) > ASP+ACCESS中学网站设计与实现(论文+源代码+开题报告+任务书)\ASP001中学网站设计与实现\zxweb\lyb\search.asp

    <%@ language=VBScript %>
<!--#include file="setup.asp"-->
<%

	on error resume next  '找不到留言资料时忽略错误
	dim keyword
	keyword = trim(Request("keyword"))
	if keyword = "" then
	message = "* 请输入查询条件!\n"
	call error(""&message&"")
	response.end
	end if
	sql="select * from gbook where body like '%"& keyword &"%' order by id desc"
	set Rs = Server.CreateObject("ADODB.Recordset")
	Rs.open sql,conn,1,1
	Rs.pagesize=pagesize
	page=Request("page")
	if (page-Rs.pagecount) > 0 then
	page=Rs.pagecount
	elseif page = "" or page < 1 then
	page = 1
	end if
	Rs.absolutepage=page
%>
<html>
<head>
<title><%=gbook_name%>--搜索留言</title>
<link rel="stylesheet" href="images/gbook.css">
</head>
<script language=javascript>
<!--
function mOvr(src){ if (!src.contains(event.fromElement)){src.bgColor = '#ffFFFF';src.children(0).style.color='#000000'}}
function mOut(src){ if (!src.contains(event.toElement)){src.bgColor = '#ebebeb';src.children(0).style.color='#000000'}}
-->
</script>
<!--#include file="inctop.asp"--><body topmargin=0>
<table width=760 height="27" border=0 align="center" cellpadding=0 cellspacing=1 background="images/dh.gif" style="border: 1px solid #CCCCCC;">
  <tr> 
    <td width="510" height="27"> <img src="images/arrow3.gif" align=absmiddle width="29" height="11"> 
      您的位置: <a href=><font color="#FF3300"><b>铁富高级中学</b></font></a> 
      >> <a href=index.asp>留言本首页</a> >> <a href=index.asp>浏览留言</a> </td>
    <td width="245"><DIV align=center>【<a href="index.asp">查看留言</a>】  【<a href="write.asp">签写留言</a>】</DIV></td>
  </tr>
</table>
<table width="760" height=20 border=0 align="center" cellpadding=0 cellspacing="1" bgcolor="#CCCCCC">
  <tr align="center"> 
    <form action="search.asp" method="post">
      <td height="20" bgcolor="#fffff0"> &nbsp;&nbsp; &nbsp;&nbsp;搜索关键字: 
        <input name="keyword" size="30" maxlength="20" style="background-color:#ffffff; color:#8888AA; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#E5F0FF'" onMouseOut = "this.style.backgroundColor = ''" value=<%=keyword%>>
        <INPUT type=submit value=搜索 name=Submit>
        &nbsp;搜索关键字[<font color=red><%=keyword%></font>]&nbsp;共有:<font color="red" face="verdana"><%=Rs.recordcount%></font>个 
      </td>
    </form>
  </tr>
</table>
<%
do while not Rs.eof
i = i + 1
if i > Rs.pagesize then
exit do
end if
ips=split(rs("ip"),".")
ip=""&ips(0)&"."&ips(1)&".*.*"
%>
<table width="760" height="73" border="0" align="center" cellpadding="0" cellspacing="0" style="border: 1px solid #CCCCCC;">
  <tr> 
    <td width="570" valign="top" bgcolor="#FFFFF0"> 
      <%
do while not Rs.eof
i = i + 1
if i > Rs.pagesize then
exit do
end if
ips=split(rs("ip"),".")
ip=""&ips(0)&"."&ips(1)&".*.*"
%>
      <table width=99% height=183 border=0 align=center cellPadding=3 cellSpacing=1 bgcolor=#99CCFF>
        <tr> 
          <td height="18" colspan="2" background="images/title.gif" bgcolor=#efefef> 
            <table width="99%" height="20" border="0" align="right" cellpadding="0" cellspacing="0">
              <tr> 
                <td width="72%"><font color="#006600">&nbsp;主题:</font><%=Rs("zt")%> 
                </td>
                <td width="28%"> <img src="images/posttime.gif" border="0" align=absmiddle>:<%=Rs("addtime")%> 
                </td>
              </tr>
            </table></td>
        <tr > 
          <td width="20%" height="154" align="center" valign='top'  bgcolor=#FFFFF0><img  src=<%=Rs("face")%> ><br> 
            <br>
            【留言者】<br>
            <%=Rs("username")%></td>
          <td width="80%" valign='top'  bgcolor=#f7f7f7><table width="100%" height="148" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="53" valign="top" background="images/bg2.gif"> 
                  <table width=100% border=0 cellspacing=0 cellpadding=0 align=center>
                    <tr> 
                      <td height=32 background=images/tdbg_left2.gif><%=Rs("username")%>说:<img src=<%=Rs("brow")%> align=absmiddle></td>
                    </tr>
                  </table>
                  <%=Rs("body")%></td>
              </tr>
              <tr> 
                <td height="20" background="images/bg2.gif"> 
                  <%
sql = "select * from reply where replyid="& Rs("id") &" order by id desc"
set Rss = Server.CreateObject("ADODB.Recordset")
Rss.open sql,conn,1,1
do while not Rss.eof
%>
                  <font color=#006633> 
                  <hr align="center" width="99%" color="#B4C9E7" size="1">
                  [管理员回复:]&nbsp;<br>
                  <%=Rss("reply")%> (<%=Rss("replytime")%>) </font> 
                  <%
Rss.movenext
loop
Rss.close
set Rss = nothing
%>
                </td>
              </tr>
              <tr> 
                <td height="20" valign="bottom"><a href='mailto:<%=Rs("email")%>' title=给<%=Rs("username")%>发信> 
                  </a> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td height="1" bgcolor="#bbbbbb"></td>
                    </tr>
                    <tr> 
                      <td height="20" bgcolor="#FFFFf0"><a href='mailto:<%=Rs("email")%>' title=给<%=Rs("username")%>发信><img border=0 src=images/mail.gif>&nbsp;</a>&nbsp; 
                        <a href=<%=Rs("homeurl")%> target=_blank title=访问<%=Rs("username")%>的主页><img border=0 src=images/home.gif>&nbsp;</a>&nbsp; 
                        <img alt=<%=Rs("username")%>的QQ号码:<%=Rs("qq")%> src=images/qq.gif>&nbsp;&nbsp; 
                        <img align=absmiddle alt=<%=Rs("username")%>的IP地址是:<%=ip%> border=0 src=images/ip.gif > 
                        &nbsp; <a href=reply.asp?replyid=<%=Rs("id")%> title=回复该留言> 
                        <img border=0 src=images/reply.gif align=absmiddle>&nbsp;</a> 
                        <a href=del.asp?id=<%=Rs("id")%> title=删除该留言> <img border=0 src=images/del.gif align=absmiddle ></a></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table>
      <table width=100% height="13" border=0 align=center cellpadding=0 cellspacing=0>
        <tr> 
          <td height=10 background=images/tdbg_left2.gif></td>
        </tr>
      </table>
      <%
Rs.movenext
loop
%>
    </td>
  </tr>
</table>
<%
Rs.movenext
loop
%><table width="90%" border="0" cellspacing="0" cellpadding="0" align="center"> 
<tr align="center"> 
    <td colspan="2"><br>
    <table width=760 border=0 cellpadding=0 cellspacing=1 bgcolor="#6699FF">
      <tr>
        <td height="25" align="center" background="images/dh.gif">查找留言<%=Rs.recordcount%>条&nbsp;共有<%=page%>/<%=Rs.pagecount%>页 
          跳到第 
          <% for go=1 to Rs.pagecount
%>
          <a href=search.asp?page=<%=go%>&keyword=<%=keyword%>><%=go%></a> 
          <%next%>
          页&nbsp; 
          <% if page=1 then %>
          <%else%>
          <a href=search.asp?page=<%=page-1%>&keyword=<%=keyword%>>上一页</a>&nbsp; 
          <%end if%>
          <% if Rs.pagecount-page <> 0 then %>
          <a href=search.asp?page=<%=page+1%>&keyword=<%=keyword%>>下一页</a>&nbsp; 
          <%else%>
          <%end if%>
        </td>
      </tr></table><br>
<%
call htmlend()
%>