📄 guestbook_body.asp
字号:
<%
rem ------------------
rem -----留言显示-----
rem ------------------
sub showgb_body()
dim totalgb,Currentpage,totalpages,i
opengb
sql="SELECT * FROM gb ORDER BY gb_id DESC"
if request("key")<>"" and request("colname")<>"" then
sql="select * from gb where "& request("colname") &" like '%"& request("key") &"%' order by gb_id desc"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table width="100%" border="0" cellspacing="1" bgcolor="#e9e9e9">
<tr>
<td>
<table cellspacing=0 width="90%" align=center border=0>
<tbody>
<tr>
<td colspan="2" align=center><font color="#990033"><%=guestbookname%></font></td>
</tr>
<tr>
<td align=left width="50%"><a class=buttonview
onFocus=if(this.blur)this.blur()
href="New_gb.asp?action=gb" target=_self>发表留言 </a> <A class=buttonview href="index.asp"
target=_self>站点首页 </A></td>
<td align=right width="50%">
<form name=search action="guestbook.asp">
<input class="input2"
title=" You can search the entire guestbook To leave search mode Search an empty string or Click the ALL link that will show up below "
name=key>
<input class=buttonsend type=submit value=搜索 name="submit">
<select name="colname">
<option value="gb_poster">留言者</option>
<option value="gb_content">留言内容</option>
</select>
</form>
</td>
</tr>
<%if not rs.eof then
rs.movefirst
rs.pagesize=gbperpage
if trim(request("page"))<>"" then
currentpage=clng(request("page"))
if currentpage>rs.pagecount then
currentpage=rs.pagecount
end if
else
currentpage=1
end if
totalgb=rs.recordcount
if currentpage<>1 then
if (currentpage-1)*gbperpage<totalgb then
rs.move(currentpage-1)*gbperpage
dim bookmark
bookmark=rs.bookmark
end if
end if
if (totalgb mod gbperpage)=0 then
totalpages=totalgb\gbperpage
else
totalpages=totalgb\gbperpage+1
end if
i=0
do while not rs.eof and i<gbperpage
sql="select * from reply where gb_id="&rs("gb_id")
set rsrep=server.createobject("adodb.recordset")
rsrep.open sql,conn,1,1%>
<tr>
<td valign=center colspan=2><a name="reply<%=i%>">
<p class=entry1header><strong><%=rs("gb_poster")%></strong> <%if rs("gb_posterfrom")<>"" then%>(<%=rs("gb_posterfrom")%>)<%end if%>
<%if rs("gb_postersex")=0 then%>
<img src="<%=themepath%>/gb_male.gif" width="18" height="14" align="middle" alt="帅哥" border="0">
<%else%>
<img src="<%=themepath%>/gb_female.gif" width="18" height="14" align="middle" alt="美女" border="0">
<%end if%>
<%if rs("gb_posteremail")<>"" then%>
<a href="mailto:<%=rs("gb_posteremail")%>" target="_blank"><img src="<%=themepath%>/gb_email.gif" width="18" height="14" align="middle" alt="<%=rs("gb_posteremail")%>" border="0"></a>
<%end if%>
<%if rs("gb_posterhome")<>"" then%>
<a href="<%=rs("gb_posterhome")%>" target="_blank"><img src="<%=themepath%>/gb_homepage.gif" width="18" height="14" align="middle" alt="<%=rs("gb_posterhome")%>" border="0"></a>
<%end if%>
<%if rs("gb_posterqq")<>"" then%>
<a href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=rs("gb_posterqq")%>"><img src="<%=themepath%>/qq-gray.gif" width="16" height="16" align="middle" alt="qq:<%=rs("gb_posterqq")%>" border="0"></a>
<%end if%>
</p></a>
<p
class=entry2text><%=ubb2html(formatStr(autourl(rs("gb_content"))), true, true)%>
<p class=entry3date><%=rs("gb_date")%> (<%=rs("gb_id")%>) <a href="New_gb.asp?action=rep&gb_id=<%=rs("gb_id")%>"><img src="<%=themepath%>/gb_comment.gif" alt="回复" border="0" align="middle"></a> <a href="Del_gb.asp?gb_id=<%=rs("gb_id")%>"><img src="<%=themepath%>/gb_trash.gif" alt="删除" border="0" align="middle"></a></p>
<%if not rsrep.eof then
dim totalrep,Currentreppage,totalreppages,j
rsrep.movefirst
rsrep.pagesize=gbrepperpage
reppage="reppage"&i
if trim(request(reppage))<>"" then
currentreppage=clng(request(reppage))
if currentreppage>rsrep.pagecount then
currentreppage=rsrep.pagecount
end if
else
currentreppage=1
end if
totalrep=rsrep.recordcount
if currentreppage<>1 then
if (currentreppage-1)*gbrepperpage<totalrep then
rsrep.move(currentreppage-1)*gbrepperpage
dim repbookmark
repbookmark=rsrep.bookmark
end if
end if
if (totalrep mod gbrepperpage)=0 then
totalreppages=totalrep\gbrepperpage
else
totalreppages=totalrep\gbrepperpage+1
end if
j=0
do while not rsrep.eof and j<gbrepperpage
k=j+1%>
<p class=comment1header><%=rsrep("rep_poster")%> 回复</p>
<p class=comment2text><%=ubb2html(formatStr(autourl(rsrep("rep_content"))), true, true)%></p>
<p class=comment3date><%=rsrep("rep_date")%></p>
<%j=j+1
rsrep.movenext
loop
end if
%>
<p class=comment2text> 共有<%=rsrep.recordcount%>条回复
<%if rsrep.recordcount<>0 then
j=1
for j=1 to totalreppages%>
<%
if j=currentreppage then
%>
<%=j%>
<%else
if request("page")<>"" then
%>
<a href="guestbook.asp?page=<%=request("page")%>&<%=reppage%>=<%=j%>#reply<%=i%>"><%=j%></a>
<%else%>
<a href="guestbook.asp?<%=reppage%>=<%=j%>#reply<%=i%>"><%=j%></a>
<%end if
end if
next
end if%>
</td>
</tr>
<%
rsrep.close
set rsrep=nothing
i=i+1
rs.movenext
loop
else
if rs.eof and rs.bof then
%>
<tr>
<td valign=center colspan=2 align="center" height="30">
<p
class=entry2text>暂时没有人留言!</p>
</td>
</tr>
<%
end if
end if
rs.close
set rs=nothing
%>
<tr>
<td colspan=2>
<p class=jumplink>[<%if request.cookies("NGB")("adminname")="" or request.cookies("NGB")("adminpwd")="" then%><A title=" 管理登录页面 "
href="admin_gb.asp" target=_self>管理</a><%else
sqla="select * from admin"
set rsa=conn.execute(sqla)
if request.cookies("NGB")("adminname")=rsa("admin_name") and request.cookies("NGB")("adminpwd")=rsa("admin_password") then%><a class=jumplink title=" 更改管理员密码 " href="
gbadmin_cp.asp">更改密码</a>/<A class=jumplink title=" 退出管理 "
href="gbadmin_logout.asp" target=_self>退出</a><%
rsa.close
set rsa=nothing
else%><A title=" 管理登录页面 "
href="admin_gb.asp" target=_self>管理</a><%end if
end if%>] [<A title=" 主页 "
href="<%=domain%>" target=_self>主页</a>] <strong>共有<%if totalgb<>"" then response.write totalgb else response.write "0" end if%>条留言|<%if totalpages<>"" then response.write totalpages else response.write "0" end if%>页
<%
i=1
for i=1 to totalpages
if i=currentpage then
%>
<%=i%>
<%else
if request("key")<>"" and request("colname")<>"" then%>
[<a href="guestbook.asp?page=<%=i%>&key=<%=request("key")%>&colname=<%=request("colname")%>"><%=i%></a>]
<%else%>
[<a href="guestbook.asp?page=<%=i%>"><%=i%></a>]
<%end if
end if
next%>
</strong> </p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
<%end sub%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -