www.gusucode.com > 维六酷博客管理系统 1.1源码程序 > bookframe.asp
<!-- #include file="conn.asp" --> <!--#include file="include.asp"--> <!-- #include file="inc/function.asp" --> <!-- #include file="inc/char.inc" --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <style type="text/css"> <!-- body,td,th { font-size: 12px; color: #666666; } body { background-color:#000000; color:#FFFFFF; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; SCROLLBAR-FACE-COLOR:#000000; } .style1 { font-size: 10px; font-style: italic; } a:link { color: #666666; text-decoration: none; } a:visited { color: #666666; text-decoration: none; } a:hover { color: #FF0000; text-decoration: none; } .style7 {COLOR: #333333; LINE-HEIGHT: 18px; FONT-FAMILY: "Verdana", "Arial", "Helvetica", "sans-serif"; font-weight: normal;} .style9 {font-size: 12px} a:active { text-decoration: none; } --> </STYLE> </HEAD> <BODY> <!--book start--> <div align="center"> <% If isBook=False Then Response.Write "留言功能已经关闭!" Response.end End If const MaxPerPage=8 '单独页最大记录数 const 用来申明常量 dim sql dim rs dim totalPut '总记录 dim CurrentPage '当前页次 dim TotalPages '总页数 dim i dim id %> <% set rs=server.createobject("adodb.recordset") If BookExamine=False Then sql="select * from book order by id desc" Else sql="select * from book where bexamine=true order by id desc" End If rs.open sql,Conn,1,1 %> </div> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="../Imgs/zw000.gif" alt="01" width="1" height="8" /></td> </tr> </table> <div align="center"> <% if rs.eof and rs.bof then %> </div> <table width="522" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td bg><div align="center">临时还没有任何留言!</div></td> </tr> </table> <div align="center"> <% else %> <!-- 分页功能代码块,可独立使用 --> <% if not rs.eof then rs.MoveFirst '注意放到前面来,否则到任何页总是在第一个记录上 end if rs.pagesize=MaxPerPage '设置每页最多显示多少条记录 If trim(Request("Page"))<>"" then '如果请求的页次不为空 If IsNumeric(trim(Request("Page"))) = False Then GoError "分页参数错误,请不要试图破坏此系统。" End If CurrentPage= CLng(request("Page")) 'clng是转换成长整型数据类型,并赋值到当前页次上 If CurrentPage> rs.PageCount then '如果当前页次大于总页数,则将最大页次赋值到当前页次上 CurrentPage = rs.PageCount End If Else CurrentPage= 1 '一切条件不成立,将当前页设为第一页 End If totalPut=rs.recordcount '将总记录赋值于TOTALPUT if CurrentPage<>1 then '如果当前页数不等于第一页 if (currentPage-1)*MaxPerPage<totalPut then '如果当前页减一乘以每页最大的记录数小于总记录的话 rs.move(currentPage-1)*MaxPerPage '相对当前记录数向后移动 dim bookmark '定义书签变量 bookmark=rs.bookmark '将当前记录的标签赋于变量BOOKMARK上 end if end if dim n,k if (totalPut mod MaxPerPage)=0 then '总记录数与每页最大记录数求余的结果为零时,则N返回整数页次,否则再加一. n= totalPut \ MaxPerPage else n= totalPut \ MaxPerPage + 1 end if %> <!-- 将RS记录指针指向第一个记录,然后开始判断移动记录时,记录结尾是否为空,如果不为空接着移动指针,把所有数据都读取出来。直到结尾为空时,退出循环 --> <% id=(totalPut-MaxPerPage*(currentPage-1))+1 i=0 Do While Not rs.EOF and i<MaxPerPage id=id-1 %> </div> <table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" class="01" style="border-right-color: #FFFFFF; border-bottom-color: #FFFFFF"> <tr> <td width="110"><div align="center">第<%=id%>位</div></td> <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="15"><img src="Imgs/posttime.gif" width="11" height="11" /></td> <td><p align="left">:<%=rs("time")%></p></td> <td width="30"><div align="left"> </div></td> <td width="30"><div align="center"> </div></td> <td width="30"><div align="center"> </div></td> <td width="30"><div align="center"><img src="Imgs/friend.gif" alt="来自:<%=rs("where")%>" width="18" height="18" /></div></td> <td width="30"><div align="center"><img src="Imgs/ip.gif" alt="IP:<%=rs("ip")%>" width="18" height="18" /></div></td> </tr> </table></td> </tr> <tr> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> <tr> <td><div align="center"><img src="<%=rs("pic")%>" width="32" height="32" /></div></td> </tr> <tr> <td height="35"><div align="center"><strong><%=rs("name")%></strong></div></td> </tr> </table> <div align="center"></div></td> <td valign="top"><table width="89%" border="0" align="center" cellpadding="0" cellspacing="0" style="table-layout:fixed;word-break:break-all"> <tr> <td width="7%"><div align="center"> </div></td> <td width="38%"> <%if rs("show")=2 then response.write"此留言内容为悄悄话,只有管理员才可查看!" %> <%else%> </td> </tr> <tr> <td colspan="2"> <%=rs("content")%> <%end if%> </td> </tr> </table> <% if rs("reply")<>"" then%> <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" style="table-layout:fixed;word-break:break-all"> <tr> <td><div align="center">---------------------------------------------------</div></td> </tr> <tr> <td>站长回复:<%=htmlencode(rs("reply"))%></td> </tr> </table> <%end if%> </td> </tr> </table> <div align="center"> <% i=i+1 rs.movenext loop %> </div> <table align="center" > <tr> <td><br /> <div align="center">当前第<%=currentpage%>页 总共<%=n%>页 共<%=rs.recordcount%>个留言 <%k=currentPage if k<>1 then response.write "[<b>"+"<a href='bookframe.asp?page=1'>首页</a></b>] " response.write "[<b>"+"<a href='bookframe.asp?page="&cstr(k-1)&"'>上一页</a></b>] " else Response.Write "[首页] [上一页]" end if if k<>n then response.write "[<b>"+"<a href='bookframe.asp?page="&cstr(k+1)&"'>下一页</a></b>] " response.write "[<b>"+"<a href='bookframe.asp?page="&cstr(n)&"'>尾页</a></b>] " else Response.Write "[下一页] [尾页]" end if %> </div></td> </tr> </table> <div align="center"> <% end if rs.close %> </div> <div align="center"></div> <div align="center"></div> <!--book end--> </BODY> </HTML>