日期:2013-01-23  浏览次数:20405 次

留言簿部分:
   班级成员留言簿: 显示留言:class/notebook/index.php
<?
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "<a href='../index.php'>请重新注册<BR>";
exit;
}
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>留言簿</TITLE>
<style type="text/css">
<!--
.blue9 {  font-size: 9pt; color: #0099FF; text-decoration: none}
.black9 {  font-size: 9pt; text-decoration: none}
.purple10 {  font-size: 10pt; color: #9900FF; text-decoration: none}
.white12 {  font-size: 12pt; color: #FFFFFF; text-decoration: none}
a:visited {  color: #FFFFFF}
a:link {  color: #FFFFFF}
-->
</style>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?php
include ("../config.php");
$result = mysql_query("SELECT * FROM notebook",$db);
$row=mysql_num_rows($result);//查看查询结果有多少行
$max=$row; //帖子总数
//设每页显示10篇,可自行设定,$p总页数,$page第几页,$low 从第几行开始读,$x 读取几行
if (!$page){ $page=1;}//$page默认值为1
$p=ceil($max/10);//页数为$max/10的最大整数
$low=10*($page-1);
if($page==$p&&($max%10)<>0){$x=($max%10);} else {$x=10;}//如果是最后一页,且不是10的整倍数,读取$max除以10的余数,否则取10
if($max==0){$x=0;}//如果没有帖子,$x取0
$result = mysql_query("select * from notebook ORDER BY time DESC limit $low,$x",$db);//按照帖子的时间降序查询
?>
<table width="98%" border="0" cellspacing="0" cellpadding="0" height="61">
  <tr>  
    <td height="62" width="34%"><img src="http://edu.cnzz.cn/image/classlogo.gif" width="224" height="60"  border="0"></td>
    <td height="62" width="66%">  
      <div align="center"><img src="http://edu.cnzz.cn/image/note.gif" width="410" height="60"><img src="http://edu.cnzz.cn/image/y1.gif" width="60" height="60"></div>
    </td>
  </tr>
</table>
<table width="95%" border="1" cellspacing="0" cellpadding="0" height="253" bordercolordark="#FFFFFF" bordercolorlight="#003399" align="center">
  <tr>  
    <td height="250">  
      <div align="center"></div>
      <table width="95%" border="0" cellspacing="0" cellpadding="0" height="32" bgcolor="#3366FF">
        <tr>  
          <td width="26%" class="white12" height="23"><a href="../guest.php" class="white12">首页</a>  
            > 留言簿</td>
          <td width="48%" class="white12" height="23">  
            <?php
          echo "帖子总数:  ",$max,"   第";
          for ($n=1;$n<=$p;$n++){
          echo "<a href=index.php?page=$n>$n</a> ";
          }
          echo "页";
          ?>
          </td>
&nbs