<% set rs=Server.CreateObject("ADODB.RecordSet") sql="select * from Feedback where online='1' order by top desc,Postdate desc" rs.open sql,conn,1 if rs.eof and rs.bof then response.redirect "book_write.asp" if pages=0 or pages="" then pages=10 '每页留言条数 rs.pageSize = pages '每页记录数 allPages = rs.pageCount '总页数 page = Request("page") '从浏览器取得当前页 'if是基本的出错处理 If not isNumeric(page) then page=1 if isEmpty(page) or Cint(page) < 1 then page = 1 elseif Cint(page) >= allPages then page = allPages end if rs.AbsolutePage = page '转到某页头部 Do While Not rs.eof and pages>0 UserName=rs("UserName") '用户名 pic=rs("pic") '头像 face=rs("face") '表情 Comments=rs("Comments") '内容 bad1=split(bad,"/") '过滤脏话 for t=0 to ubound(bad1) Comments=replace(Comments,bad1(t),"***") next Replay=rs("Replay") '回复 Usermail=rs("Usermail") '邮件 url=rs("url") '主页 I=I+1 '序号 temp=RS.RecordCount-(page-1)*rs.pageSize-I+1 %>
.gif border=0>
[NO.<%=temp%>] .gif> 发表于:<%=cstr(rs("Postdate"))%>
<% '是否屏蔽留言内容中的html字符 if html=0 then response.write replace(server.htmlencode(Comments),vbCRLF,"
") else response.write replace(Comments,vbCRLF,"
") end if %>

<%if rs("Replay")<>"" then%>

<%end if%>
<% pages = pages - 1 rs.movenext if rs.eof then exit do loop %>
<% response.write "
       总计留言"&RS.RecordCount&"条 " if page = 1 then response.write "首页 前页" else response.write "首页 前页" end if if page = allpages then response.write " 下页 末页" else response.write " 下页 末页" end if response.write " 第"&page&"页 共"&allpages&"页 " %>