杏林同学录(八)

留言簿部分:
   班级成员留言簿: 显示留言: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=”../image/classlogo.gif” width=”224″
height=”60″  border=”0″></td>
    <td height=”62″ width=”66%”>  
      <div align=”center”><img src=”../image/note.gif”
width=”410″ height=”60″><img src=”../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>
          <td width=”15%” height=”23″><a
href=”addnote.php”><img src=”../image/newthread.gif” width=”91″
height=”21″ border=”0″></a></td>
          <td width=”11%” height=”23″><a
href=”delnote.php”><span
class=”white12″>留言管理</span></a></td>
        </tr>
      </table>  
<?php
   for ($i=0;$i<=($x-1);$i++) {
   $user=mysql_result($result,$i,’user’);
   $time=mysql_result($result,$i,’time’);
   $ip=mysql_result($result,$i,’ip’);
   $title=mysql_result($result,$i,’title’);
   $nnote=mysql_result($result,$i,’nnote’);
   $yresult = mysql_query(“SELECT * FROM user where
user=’$user'”,$db);//读取成员数据库
   $name=mysql_result($yresult,0,’name’);
   $signature=mysql_result($yresult,0,’signature’);//读取个人签名
   $email=mysql_result($yresult,0,’email’);
   $face=mysql_result($yresult,0,’face’);
   $face=’../image/face/icon’.$face;

班级管理部分:
   首页:superadmin.php
<?php
include (“class/config.php”);
if ($superadmin){      //如果已经进行管理员登陆,进行密码验证
  if (!($supername==$supervisor)||!($superpass==$superpsw)){  
   echo “密码错误”;
   exit;
   }else{ //用session记录管理员登陆
   session_start(); // 开始session
   session_register(“superlogin”);
   $superlogin=$supername;   
   }
}else{              //管理员登陆
echo “<form name=’form1′ method=’post’ action=’$PHP_SELF’>”;
echo “<div align=’center’> 请输入管理员密码<br>”;
echo “管理员”;  
echo “<input type=’text’ name=’supername’><br>”;
echo “密码”;
echo “<input type=’password’ name=’superpass’><br>”;
echo “<input type=’submit’ name=’superadmin’
value=’进入’><br>”;
echo “<input type=’reset’ name=’cancel’
value=’重写’></div>”;   
echo “</form>”;
exit;
}
?>
<html>
<head>
<title>班级管理</title>
<meta http-equiv=”Content-Type” content=”text/html;
charset=gb2312″>
</head>

注册部分:
   注册步骤1: class/register_step1.php
<HTML>
<HEAD>
<meta http-equiv=”Content-Type” content=”text/html;
charset=gb2312″>
<TITLE>班级通讯录-注册第一步</TITLE>
</HEAD>
<BODY BGCOLOR=”#FFFFFF”>
<?php
include “config.php”;
if ($Submit){
$answers1=trim($answers1);
$answers2=trim($answers2);
if (!($answers1==$answer1)||!($answers2==$answer2)){
echo “回答错误!<a
href=’javascript:history.back()’>返回</a>”;
exit;
}
echo “回答正确,<a
href=’register_step2.php?answer=right’>进入第二步</a>。”;
exit;
}
?>
<table width=”73%” border=”0″ cellspacing=”0″ cellpadding=”0″
align=”center” height=”190″>
  <tr>  
    <td height=”76″>
      <div align=”center”><img src=”image/classlogo.gif”
width=”224″ height=”60″></div>
    </td>
  </tr>
  <tr>
    <td height=”32″>  
      <div align=”center”>注册第一步-身份验证</div>
    </td>
  </tr>
  <tr>
    <td height=”153″>
      <p align=”center”>请回答以下问题</p>
      <form name=”form1″ method=”post” action=”<? echo
$PHP_SELF;?>”>
        <div align=”center”>1.<? echo
$question1?><br>
          您的回答  
          <input type=”text” name=”answers1″>
          <br>
          2.<? echo $question2?><br>
          您的回答  
          <input type=”text” name=”answers2″>
          <br>
          <input type=”submit” name=”Submit” value=”确认”>
          <input type=”reset” name=”cancel” value=”重写”>
        </div>
      </form>
      <p align=”center”><br>
        <br>
        实在想不起来了,<a
href=”querypsw.php”>问问管理员吧</a>。<br>
      </p>
    </td>
  </tr>
</table>
</BODY>
</HTML>
注册步骤2: class/register_step2.php
<HTML>
<HEAD>
<meta http-equiv=”Content-Type” content=”text/html;
charset=gb2312″>
<TITLE>94级1班通讯录-注册第二步</TITLE>
</HEAD>
<BODY BGCOLOR=”#FFFFFF”>
<?php
if (!$answer==”right”){          //页面保护
echo “请不要投机取巧!”;
exit;
}
include “config.php”;
if ($submit){
if
(!$username||!$psw||!$psw2||!$name||!$ad||!$ph||!$email){           //检查是否填写完整
      echo “对不起,您2必须填所有带*的项目!<BR>”.”<a
href=’javascript:history.back()’>返回</a>”;
      exit;
    }
$username=trim($username);
$psw=trim($psw);
$psw2=trim($psw2);
$name=trim($name);
$birth=$year.’-‘.$month.’-‘.$day;
$work=trim($work);
$ad=trim($ad);
$post=trim($post);
$ph=trim($ph);
$bp=trim($bp);
$email=trim($email);
$oicq=trim($oicq);
$account=strip_tags(trim($account));//去掉首尾空格及html标记
$signature=strip_tags(trim($signature));
//检验此名字是否已被注册
$result = mysql_query(“SELECT name FROM user where
name=’$name'”,$db);
if (mysql_num_rows($result)!=0){   
echo “此名字已有人注册!”.”<a
href=’javascript:history.back()’>重新填写</a> “.”忘记密码,向管理员<a
href=’querypsw.php’>索要密码</a>”;
exit;
}
//检验用户名是否被使用
$result = mysql_query(“SELECT user FROM user where
user=’$username'”,$db);//若返回列的数目不为0,说明此用户名已有人使用
if (mysql_num_rows($result)!=0){   
echo “此用户名已有人使用!”.”<a
href=’javascript:history.back()’>重新填写</a>”;
exit;
}
//检查密码重复是否正确
if (!$psw==$psw2){
echo “请确认密码,<a
href=’javascript:history.back()’>返回</a>”;
exit;
}
//检查email的合法性
if(!ereg(‘^[-!#$%&’*+./0-9=?A-Z^_`a-z{|}~]+’.’@’.'[-!#$%&’*+\/0-9=?A-Z^_`a-z{|}~]+.’.'[-!#$%&’*+\./0-9=?A-Z^_`a-z{|}~]+$’,$email)&&$email){
       echo “email不合法!<BR>”.”<a
href=’javascript:history.back()’>重填</a><BR>”;
       exit;}
//写入数据库
  $sql=”INSERT INTO user
(user,psw,name,sex,birth,work,ad,post,ph,bp,email,oicq,account,signature,face)
VALUES
(‘$username’,’$psw’,’$name’,’$sex’,’$birth’,’$work’,’$ad’,’$post’,’$ph’,’$bp’,’$email’,’$oicq’,’$account’,’$signature’,’$face’)”;
$result = mysql_query($sql,$db);
mysql_close($db);
//发祝贺邮件
$subject=”祝贺你成功注册”.$sitename.”!”;//主题
$message=$name.”,你好:<BR>  祝贺你成功注册同学录!您的用户名为”.$username.”,密码为”.$psw.”<BR>现在登陆<a
href=’$url’>$sitename</a>”;//信件内容
$headers .= “Content-Type: text/html; charset=gb2312n”; // Mime type
mail($email,$subject,$message,$headers);//离线状态下调试时,这一句可能会出错,不必管它,传到服务器上即可。
echo “恭喜您注册成功!一封欢迎信已发到您的邮箱,请注意查收。”,”<a
href=’../index.php’>现在登录</a>”;  
exit;
}  
?>
<table width=’95%’ border=’0′ cellspacing=’0′ cellpadding=’0′
align=’center’>
  <tr>  
    <td colspan=”2″>  
      <div align=”center”><img src=”image/classlogo.gif”
width=”224″ height=”60″></div>
    </td>
  </tr>
  <tr>  
    <td>  
      <div align=”center”>注册第二步-填写个人资料<br>
        注意不要有空格,带*的项目为必填。</div>
    </td>
  </tr>
  <tr>  
    <td colspan=”2″>  
      <form method=’post’ action='<? echo
$PHP_SELF;?>?answer=right’>
        <table width=”95%” border=”1″ cellspacing=”1″ cellpadding=”0″
align=”center” bordercolor=”#FFCC00″>
          <tr>
            <td height=”153″ width=”60%”><br>
              用户名:  
              <input type=’Text’ name=’username’ size=’12’
maxlength=’12’>
              *<br>
              (英文字母或加数字,长度不超过12)<br>
          密码:  
          <input type=’password’ name=’psw’ size=’8′
maxlength=’8′>
              *<br>
              (英文字母或加数字,长度不超过8个字符)<br>
          确认密码:  
          <input type=’password’ name=’psw2′ size=’8′
maxlength=’8′>
          *<br>
          姓名:  
          <input type=’Text’ name=’name’ size=’8′ maxlength=’8′>
          *<br>
          性别:男  
          <input type=’radio’ name=’sex’ value=’男’ checked>
          女  
          <input type=’radio’ name=’sex’ value=’女’>
          <br>
          生日:  
          <select name=’year’>
            <option selected>1991</option>
            <option>1990</option>
            <option>1989</option>
            <option>1988</option>
            <option>1987</option>
            <option>1986</option>
            <option>1985</option>
            <option>1984</option>
            <option>1983</option>
            <option>1982</option>
            <option>1981</option>
            <option>1980</option>
            <option>1979</option>
            <option>1978</option>
            <option>1977</option>
            <option>1976</option>
            <option>1975</option>
            <option>1974</option>
            <option>1973</option>
            <option>1972</option>
            <option>1971</option>
            <option>1970</option>
            <option>1969</option>
            <option>1968</option>
            <option>1967</option>
            <option>1966</option>
            <option>1965</option>
            <option>1964</option>
            <option>1963</option>
            <option>1962</option>
            <option>1961</option>
            <option>1960</option>
            <option>1959</option>
            <option>1958</option>
            <option>1957</option>
            <option>1956</option>
            <option>1955</option>
            <option>1954</option>
          </select>
          年  
          <select name=’month’>
            <option selected>01</option>
            <option>02</option>
            <option>03</option>
            <option>04</option>
            <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>
            <option>11</option>
            <option>12</option>
          </select>
          月  
          <select name=’day’>
            <option selected>01</option>
            <option>02</option>
            <option>03</option>
            <option>04</option>
            <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>
            <option>11</option>
            <option>12</option>
            <option>13</option>
            <option>14</option>
            <option>15</option>
            <option>16</option>
            <option>17</option>
            <option>18</option>
            <option>19</option>
            <option>20</option>
            <option>21</option>
            <option>22</option>
            <option>23</option>
            <option>24</option>
            <option>25</option>
            <option>26</option>
            <option>27</option>
            <option>28</option>
            <option>29</option>
            <option>30</option>
            <option>31</option>
          </select>
          日<br>
          工作单位:  
          <input type=’Text’ name=’work’ size=’30’
maxlength=’50’>
          <br>
          通讯地址:  
          <input type=’Text’ name=’ad’ size=’30’ maxlength=’50’>
          *<br>
          邮编:  
          <input type=’Text’ name=’post’ size=’6′ maxlength=’6′>
          <br>
          电话:  
          <input type=’Text’ name=’ph’ size=’15’ maxlength=’30’>
          *<br>
          传呼:  
          <input type=’Text’ name=’bp’ size=’15’ maxlength=’20’>
          <br>
          Email:  
          <input type=’Text’ name=’email’ size=’15’
maxlength=’35’>
          *<br>
          oicq:  
          <input type=’Text’ name=’oicq’ size=’12’
maxlength=’12’>
          <br>
          个人说明:(在通讯录里显示,不超过125个汉字)<BR>
          <textarea name=’account’ cols=’50’
rows=’5′></textarea>
          <br>
          个人签名:(在留言簿的自动签名,不超过125个汉字)<br>
              <textarea name=”signature” cols=”50″
rows=”5″></textarea>
            </td>
            <td height=”153″ width=”40%”><br>
              选择一个自己喜欢的头像:<br>
          <img src=”image/face/icon1.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”1″ checked>
          <img src=”image/face/icon2.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”2″>
          <img src=”image/face/icon3.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”3″>
          <img src=”image/face/icon4.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”4″>
          <img src=”image/face/icon5.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”5″>
          <img src=”image/face/icon6.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”6″>
          <img src=”image/face/icon7.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”7″>
          <img src=”image/face/icon8.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”8″>
          <img src=”image/face/icon9.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”9″>
          <img src=”image/face/icon10.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”10″>
              <img src=”image/face/icon11.gif” width=”32″
height=”32″>  
              <input type=”radio” name=”face” value=”11″>
          <img src=”image/face/icon12.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”12″>
          <img src=”image/face/icon13.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”13″>
          <img src=”image/face/icon14.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”14″>
          <img src=”image/face/icon15.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”15″>
          <img src=”image/face/icon16.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”16″>
          <img src=”image/face/icon17.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”17″>
          <img src=”image/face/icon18.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”18″>
          <img src=”image/face/icon19.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”19″>
          <img src=”image/face/icon20.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”20″>
          <br>
          <img src=”image/face/icon21.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”21″>
          <img src=”image/face/icon22.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”22″>
          <img src=”image/face/icon23.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”23″>
          <img src=”image/face/icon24.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”24″>
          <img src=”image/face/icon25.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”25″>
          <img src=”image/face/icon26.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”26″>
          <img src=”image/face/icon27.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”27″>
          <img src=”image/face/icon28.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”28″>
          <img src=”image/face/icon29.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”29″>
          <img src=”image/face/icon30.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”30″>
          <img src=”image/face/icon31.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”31″>
          <img src=”image/face/icon32.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”32″>
          <img src=”image/face/icon33.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”33″>
          <img src=”image/face/icon34.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”34″>
          <img src=”image/face/icon35.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”35″>
          <img src=”image/face/icon36.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”36″>
          <img src=”image/face/icon37.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”37″>
          <img src=”image/face/icon38.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”38″>
          <img src=”image/face/icon39.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”39″>
          <img src=”image/face/icon40.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”40″>
          <br>
          <img src=”image/face/icon41.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”41″>
          <img src=”image/face/icon42.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”42″>
          <img src=”image/face/icon43.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”43″>
          <img src=”image/face/icon44.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”44″>
          <img src=”image/face/icon45.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”45″>
          <img src=”image/face/icon46.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”46″>
          <img src=”image/face/icon47.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”47″>
          <img src=”image/face/icon48.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”48″>
          <img src=”image/face/icon49.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”49″>
          <img src=”image/face/icon50.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”50″>
              <img src=”image/face/icon51.gif” width=”32″
height=”32″>  
              <input type=”radio” name=”face” value=”51″>
          <img src=”image/face/icon52.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”52″>
          <img src=”image/face/icon53.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”53″>
          <img src=”image/face/icon54.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”54″>
          <img src=”image/face/icon55.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”55″>
          <img src=”image/face/icon56.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”56″>
          <img src=”image/face/icon57.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”57″>
          <img src=”image/face/icon58.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”58″>
          <img src=”image/face/icon59.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”59″>
          <img src=”image/face/icon60.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”60″>
          <br>
          <img src=”image/face/icon61.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”61″>
          <img src=”image/face/icon62.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”62″>
          <img src=”image/face/icon63.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”63″>
          <img src=”image/face/icon64.gif” width=”32″
height=”32″>  
          <input type=”radio” name=”face” value=”64″>
          <br>
            </td>
          </tr>
        </table>
        <div align=”center”>
          <br>
          <input type=’Submit’ name=’submit’ value=’提交’>
          <input type=’reset’ name=’Reset’ value=’重写 ‘>
        </div>
      </form>
    </td>
  </tr>
</table>
</BODY>
</HTML> 

主要特点:
   php+mysql,session页面保护,悄悄话功能,照片上传,在线修改资料,email查询及自动回复,客人模式,
   方便的班级管理
程序清单:
配置部分:
   配置文件:class/config.php 数据库文件:class/mysql.txt
计数器文件:class/counter.txt  
主程序:
   登陆首页:index.php 成员主页:main.php 客人主页:class/guest.php  
个人管理:
   班级通讯录:class/address.php 个人资料修改:class/modify.php
上传照片:class/uploadphoto.php
   密码查询:class/querypsw.php 悄悄话:privatenote.php
注册部分:
   注册步骤1: class/register_step1.php 注册步骤2:
class/register_step2.php
照片部分:
   班级照片:class/classphoto.php 学校照片:class/schoolphoto.php
个人照片:class/privatephoto.php
留言簿部分:
   班级成员留言簿: 显示留言:class/notebook/index.php
添加留言:class/notebook/addnote.php
   客人留言簿:   显示留言:class/notebookg/index.php
添加留言:class/notebookg/addnote.php
班级管理部分:
   首页:superadmin.php 添加成员:class/admin/addmember.php
显示、删除成员:class/admin/member.php
   修改成员资料:class/admin/editmember.php
修改成员资料步骤2:class/admin/editmember_step2.php  
   班级成员留言簿管理: class/notebook/delnote.php 客人留言簿管理:
class/notebookg/delnote.php
其它:
   帮助文件:readme.txt 图片:class/image

班级成员留言簿管理: class/notebook/delnote.php
<?php
session_start();
if(!session_is_registered(“superlogin”))//检查是否注册
{
echo “<a
href=’../../superadmin.php’>请重新进行管理员登陆<BR>”;
exit;
}
include (“../config.php”);
if($del==1){       //判断是否要删除
mysql_query(“delete from notebook where time=’$time'”,$db);
//以留言时间为删除标志
echo “删除成功!”;
}
?>
<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
$result = mysql_query(“SELECT * FROM notebook”,$db);
$row=mysql_num_rows($result);//查看结果有多少行
$max=$row; //帖子总数
//设每页显示10篇,$p总页数,$page第几页,$low 从第几行开始读,$x
读取几行
if (!$page){$page=1;}
$p=ceil($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=”../image/classlogo.gif” width=”224″ height=”60″
border=”0″></td>
    <td height=”62″ width=”66%”>  
      <div align=”center”><img src=”../image/note.gif”
width=”410″ height=”60″><img src=”../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″>
      <table width=”95%” border=”0″ cellspacing=”0″ cellpadding=”0″
height=”32″ bgcolor=”#3366FF”>
        <tr>  
          <td width=”28%” class=”white12″><a
href=”../guest.php” class=”white12″>首页</a>  
            > <a href=”index.php”
class=”white12″>留言簿</a></td>
          <td width=”56%” class=”white12″>  
            <?php
          echo “帖子总数:  “,$max,”   第”;
          for ($n=1;$n<=$p;$n++){
          echo “<a href=index.php?page=$n>$n</a> “;
          }
          echo “页”;
          ?>
          </td>
          <td width=”16%”><a href=”index.php”
class=”white12″>查看留言</a></td>
        </tr>
      </table>  
<?php
   for ($i=0;$i<=($x-1);$i++) {
   $user=mysql_result($result,$i,’user’);
   $time=mysql_result($result,$i,’time’);
   $ip=mysql_result($result,$i,’ip’);
   $title=mysql_result($result,$i,’title’);
   $nnote=mysql_result($result,$i,’nnote’);
   $yresult = mysql_query(“SELECT * FROM user where
user=’$user'”,$db);//读取成员数据库
   $name=mysql_result($yresult,0,’name’);
   $signature=mysql_result($yresult,0,’signature’);//读取个人签名
   $email=mysql_result($yresult,0,’email’);
   $face=mysql_result($yresult,0,’face’);
   $face=’../image/face/icon’.$face;
  echo “<table width=’100%’ border=’0′ cellspacing=’0′
cellpadding=’0′ height=107′ bordercolor=’#FFFFFF’> <tr
bgcolor=’#eeeeee’>”;  
echo “<td width=’10%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′> <img src=’$face.gif’ width=’32’
height=’32’></td>”;
echo        “<td width=’16%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′>留言人:$name</td>”;
echo        “<td width=’41%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′>发表于:$time</td>”;
echo        “<td width=’12%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′><a href=’mailto:$email’><img
src=’../image/email.gif’ width=’16’ height=’16’
border=0></a></td>”;
echo        “<td width=’21%’ height=’33’ class=’blue9′><img
src=’../image/ip.gif’ width=’13’ height=’15’>  $ip <a
href=’$PHP_SELF?del=1&time=$time’><img src=’../image/del.gif’
width=’16’ height=’16’ border=0></a></td>  </tr>
<tr>”;  
echo        “<td colspan=’5′ class=’purple10′
height=’33’>标题:$title</td> </tr>”;
echo        “<tr bgcolor=’#ffffff’><td colspan=’5′
class=’black9′
height=’37’>留言内容:$nnote</td></tr></table>”;
}
mysql_close($db);
?>     
    </td>
</tr>
</table>
</BODY>
</HTML>
客人留言簿管理: class/notebookg/delnote.php
<?php
session_start();
if(!session_is_registered(“superlogin”))//检查是否注册
{
echo “<a
href=’../../superadmin.php’>请重新进行管理员登陆<BR>”;
exit;
}
include (“../config.php”);
if($del==1){       //判断是否要删除
mysql_query(“delete from notebookg where time=’$time'”,$db);
//以留言时间为删除标志
echo “删除成功!”;
}
?>
<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
$result = mysql_query(“SELECT * FROM notebookg “,$db);
$row=mysql_num_rows($result);//查看结果有多少行
$max=$row; //帖子总数
//设每页显示10篇,$p总页数,$page第几页,$low 从第几行开始读,$x
读取几行
if (!$page){$page=1;}
$p=ceil($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 notebookg 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=”../image/classlogo.gif” width=”224″ height=”60″
border=”0″></td>
    <td height=”62″ width=”66%”>  
      <div align=”center”><img src=”../image/note.gif”
width=”410″ height=”60″><img src=”../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″>
      <table width=”95%” border=”0″ cellspacing=”0″ cellpadding=”0″
height=”32″ bgcolor=”#3366FF”>
        <tr>  
          <td width=”28%” class=”white12″><a
href=”../guest.php” class=”white12″>首页</a>  
            > <a href=”index.php”
class=”white12″>留言簿</a></td>
          <td width=”56%” class=”white12″>  
            <?php
          echo “帖子总数:  “,$max,”   第”;
          for ($n=1;$n<=$p;$n++){
          echo “<a href=index.php?page=$n>$n</a> “;
          }
          echo “页”;
          ?>
          </td>
          <td width=”16%”><a href=”index.php”
class=”white12″>查看留言</a></td>
        </tr>
      </table>  
<?php
   for ($i=0;$i<=($x-1);$i++) {
   $email=mysql_result($result,$i,’email’);
   $face=mysql_result($result,$i,’face’);
   $face=’../image/face/icon’.$face;
   $name=mysql_result($result,$i,’name’);
   $time=mysql_result($result,$i,’time’);
   $ip=mysql_result($result,$i,’ip’);
   $title=mysql_result($result,$i,’title’);
   $nnote=mysql_result($result,$i,’nnote’);
echo “<table width=’100%’ border=’0′ cellspacing=’0′ cellpadding=’0′
height=107′ bordercolor=’#FFFFFF’> <tr
bgcolor=’#eeeeee’>”;  
echo “<td width=’10%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′> <img src=’$face.gif’ width=’32’
height=’32’></td>”;
echo        “<td width=’16%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′>留言人:$name</td>”;
echo        “<td width=’41%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′>发表于:$time</td>”;
echo        “<td width=’12%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′><a href=’mailto:$email’><img
src=’../image/email.gif’ width=’16’ height=’16’
border=0></a></td>”;
echo        “<td width=’21%’ height=’33’ class=’blue9′><img
src=’../image/ip.gif’ width=’13’ height=’15’>  $ip <a
href=’$PHP_SELF?del=1&time=$time’><img src=’../image/del.gif’
width=’16’ height=’16’ border=0></a></td>  </tr>
<tr>”;  
echo        “<td colspan=’5′ class=’purple10′
height=’33’>标题:$title</td> </tr>”;
echo        “<tr bgcolor=’#ffffff’><td colspan=’5′
class=’black9′
height=’37’>留言内容:$nnote</td></tr></table>”;
}
mysql_close($db);
?>     
    </td>
</tr>
</table>
</BODY>
</HTML> 

echo “<table width=’100%’ border=’0′ cellspacing=’0′ cellpadding=’0′
height=107′ bordercolor=’#FFFFFF’> <tr
bgcolor=’#eeeeee’>”;  
echo “<td width=’10%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′> <img src=’$face.gif’ width=’32’
height=’32’></td>”;
echo        “<td width=’16%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′>留言人:$name</td>”;
echo        “<td width=’41%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′>发表于:$time</td>”;
echo        “<td width=’12%’ height=’33’ bgcolor=’#eeeeee’
class=’blue9′><a href=’mailto:$email’><img
src=’../image/email.gif’ width=’16’ height=’16’
border=0></a></td>”;
echo        “<td width=’21%’ height=’33’ class=’blue9′><img
src=’../image/ip.gif’ width=’13’ height=’15’>
 $ip</td>  </tr> <tr>”;  
echo        “<td colspan=’5′ class=’purple10′
height=’33’>标题:$title</td> </tr>”;
echo        “<tr bgcolor=’#ffffff’><td colspan=’5′
class=’black9′
height=’37’>留言内容:$nnote<BR>———————-<BR>$signature</td></tr></table>”;
}
mysql_close($db);
?>     
    </td>
</tr>
</table>
</BODY>
</HTML>
添加留言:class/notebook/addnote.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”>
<!–
.white12 {  font-size: 12pt; color: #FFFFFF; text-decoration: none}
–>
</style>
</HEAD>
<BODY BGCOLOR=”#FFFFFF”>
<table width=”98%” border=”0″ cellspacing=”0″ cellpadding=”0″
height=”61″>
  <tr>  
    <td height=”62″ width=”34%”><img
src=”../image/classlogo.gif” width=”224″ height=”60″
border=”0″></td>
    <td height=”62″ width=”66%”>  
      <div align=”center”><img src=”../image/note.gif”
width=”410″ height=”60″><img src=”../image/y1.gif” width=”60″
height=”60″></div>
    </td>
  </tr>
</table>
<?php
include (“../config.php”);
if ($submit){
$time=date(“Y年m月d日 H:i:s A”);
$ip=$REMOTE_ADDR;//留言人ip地址
$title=strip_tags($top);
$nnote=nl2br(strip_tags($content));//先去掉html标记,再将换行符转成
<br>。
if (!$title||!$nnote){           //检查是否填写完整
      echo “对不起,您必须填所有内容!<BR>”.”<a
href=’javascript:history.back()’>返回</a>”;
      exit; }
   //写入数据库
$sql=”INSERT INTO notebook (user,time,ip,title,nnote) VALUES
(‘$userregister’,’$time’,’$ip’,’$title’,’$nnote’)”;
$result = mysql_query($sql,$db);
mysql_close($db);
echo “留言成功!”;
}
?>
<table width=”99%” border=”1″ cellspacing=”0″ cellpadding=”0″
align=”center” bordercolor=”#3366FF”>
  <tr bgcolor=”#3366FF”>  
    <td width=”81%” class=”white12″ height=”26″><a
href=”../../main.php” class=”white12″>首页</a>  
      > <a href=”index.php” class=”white12″>留言簿</a>
> 添加留言</td>
    <td width=”19%” class=”white12″ height=”26″><a
href=’index.php’ class=”white12″>查看留言</a>  
    </td>
  </tr>
  <tr>  
    <td colspan=”2″>
      <form name=”form1″ method=”post” action=”addnote.php”>
        <table width=”99%” border=”0″ cellspacing=”0″
cellpadding=”0″>
          <tr>  
            <td>  
              <div align=”center”>标题<br>
                <input type=”text” name=”top” size=”50″>
                <br>
                内容<br>
                <textarea name=”content” cols=”50″
rows=”6″></textarea>
                <br>
                <input type=”submit” name=”submit” value=”确定”>
                <input type=”reset” name=”cancel” value=”重写”>
              </div>
            </td>
          </tr>
        </table>
              </form>
    </td>
  </tr>
</table>
<p><a href=”main.php?user=<?%20echo%20$user?>”
class=”white12″><br>
  </a></p>
</BODY>
</HTML>

<body bgcolor=”#FFFFFF” text=”#000000″>
<p> </p>
<table width=”73%” border=”0″ cellspacing=”0″ cellpadding=”0″
align=”center” height=”208″>
  <tr>  
    <td>
      <div align=”center”><img src=”class/image/classlogo.gif”
width=”224″ height=”60″></div>
    </td>
  </tr>
  <tr>  
    <td>  
      <div align=”center”>班级管理</div>
    </td>
  </tr>
  <tr>  
    <td>  
      <div align=”center”>
        <a href=”class/admin/addmember.php”
target=”_blank”>添加成员</a><br>
        <a href=”class/admin/member.php”
target=”_blank”>显示、删除成员</a><br>
        <a href=”class/admin/editmember.php”
target=”_blank”>修改成员信息</a><br>
        <a href=”class/notebook/delnote.php”
target=”_blank”>班级留言管理</a><br>
        <a href=”class/notebookg/delnote.php”
target=”_blank”>客人留言管理</a></div>
    </td>
  </tr>
</table>
</body>
</html>
添加成员:class/admin/addmember.php
<?
session_start();
if(!session_is_registered(“superlogin”))//检查是否注册
{
echo “<a
href=’../../superadmin.php’>请重新进行管理员登陆<BR>”;
exit;
}
include “../config.php”;
if ($submit){
if (!$username||!$name){           //检查是否填写完整
      echo “对不起,您必须填所有带*的项目!<BR>”.”<a
href=’javascript:history.back()’>返回</a>”;
      exit;
    }
$username=trim($username);
$psw=trim($psw);
$name=trim($name);
$birth=$year.’-‘.$month.’-‘.$day;
$work=trim($work);
$ad=trim($ad);
$post=trim($post);
$ph=trim($ph);
$bp=trim($bp);
$email=trim($email);
$oicq=trim($oicq);
//检验此名字是否已被注册
$result = mysql_query(“SELECT name FROM user where
name=’$name'”,$db);
if (mysql_num_rows($result)!=0){   
echo “此名字已有人注册!”.”<a
href=’javascript:history.back()’>重新填写</a> “.”忘记密码,向管理员<a
href=’querypsw.php’>索要密码</a>”;
exit;
}
//检验用户名是否被使用
$result = mysql_query(“SELECT user FROM user where
user=’$username'”,$db);//若返回列的数目不为0,说明此用户名已有人使用
if (mysql_num_rows($result)!=0){   
echo “此用户名已有人使用!”.”<a
href=’javascript:history.back()’>重新填写</a>”;
exit;
}
//写入数据库
  $sql=”INSERT INTO user
(user,psw,name,sex,birth,work,ad,post,ph,bp,email,oicq) VALUES
(‘$username’,’$psw’,’$name’,’$sex’,’$birth’,’$work’,’$ad’,’$post’,’$ph’,’$bp’,’$email’,’$oicq’)”;
$result = mysql_query($sql,$db);
mysql_close($db);
echo “添加成功”;  
exit;
}
?>
<HTML>
<HEAD>
<meta http-equiv=”Content-Type” content=”text/html;
charset=gb2312″>
<TITLE> 添加成员 </TITLE>
</HEAD>
<BODY BGCOLOR=”#FFFFFF”>
<form method=’post’ action='<? echo $PHP_SELF;?>’>

注意事项:
1.先将配置文件config.php改好再上传,按照mysql.txt内容建立数据库。
2.上传时将counter.txt的属性改为777
3.照片上传程序在某些主页空间无法实现,大家试试51.net吧,注意保留class/upload/image目录。
4.在本机调试时,mail()函数可能会出错,不必理它,上传到服务器即可。
5.由于时间仓促,也考虑到照片上传不容易在个人主页实现,班级照片、个人照片等页面请大家自己修改吧。
6.本人初学php,程序尚需进一步完善,本程序仅供菜鸟参考。

  <table width=”51%” border=”1″ cellspacing=”1″ cellpadding=”0″
align=”center” bordercolor=”#FFCC00″>
    <tr>
            <td height=”153″ width=”60%”><br>
              用户名:  
              <input type=’Text’ name=’username’ size=’12’
maxlength=’12’>
              *<br>
              (英文字母或加数字,长度不超过12)<br>
          密码:  
          <input type=’password’ name=’psw’ size=’8′
maxlength=’8′>
              <br>
              (英文字母或加数字,长度不超过8个字符)<br>
          姓名:  
          <input type=’Text’ name=’name’ size=’8′ maxlength=’8′>
          *<br>
          性别:男  
          <input type=’radio’ name=’sex’ value=’男’ checked>
          女  
          <input type=’radio’ name=’sex’ value=’女’>
          <br>
          生日:  
          <select name=’year’>
            <option selected>1991</option>
            <option>1990</option>
            <option>1989</option>
            <option>1988</option>
            <option>1987</option>
            <option>1986</option>
            <option>1985</option>
            <option>1984</option>
            <option>1983</option>
            <option>1982</option>
            <option>1981</option>
            <option>1980</option>
            <option>1979</option>
            <option>1978</option>
            <option>1977</option>
            <option>1976</option>
            <option>1975</option>
            <option>1974</option>
            <option>1973</option>
            <option>1972</option>
            <option>1971</option>
            <option>1970</option>
            <option>1969</option>
            <option>1968</option>
            <option>1967</option>
            <option>1966</option>
            <option>1965</option>
            <option>1964</option>
            <option>1963</option>
            <option>1962</option>
            <option>1961</option>
            <option>1960</option>
            <option>1959</option>
            <option>1958</option>
            <option>1957</option>
            <option>1956</option>
            <option>1955</option>
            <option>1954</option>
          </select>
          年  
          <select name=’month’>
            <option selected>01</option>
            <option>02</option>
            <option>03</option>
            <option>04</option>
            <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>
            <option>11</option>
            <option>12</option>
          </select>
          月  
          <select name=’day’>
            <option selected>01</option>
            <option>02</option>
            <option>03</option>
            <option>04</option>
            <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>
            <option>11</option>
            <option>12</option>
            <option>13</option>
            <option>14</option>
            <option>15</option>
            <option>16</option>
            <option>17</option>
            <option>18</option>
            <option>19</option>
            <option>20</option>
            <option>21</option>
            <option>22</option>
            <option>23</option>
            <option>24</option>
            <option>25</option>
            <option>26</option>
            <option>27</option>
            <option>28</option>
            <option>29</option>
            <option>30</option>
            <option>31</option>
          </select>
          日<br>
          工作单位:  
          <input type=’Text’ name=’work’ size=’30’
maxlength=’50’>
          <br>
          通讯地址:  
          <input type=’Text’ name=’ad’ size=’30’ maxlength=’50’>
          <br>
          邮编:  
          <input type=’Text’ name=’post’ size=’6′ maxlength=’6′>
          <br>
          电话:  
          <input type=’Text’ name=’ph’ size=’15’ maxlength=’30’>
          <br>
          传呼:  
          <input type=’Text’ name=’bp’ size=’15’ maxlength=’20’>
          <br>
          Email:  
          <input type=’Text’ name=’email’ size=’15’
maxlength=’35’>
          <br>
          oicq:  
          <input type=’Text’ name=’oicq’ size=’12’
maxlength=’12’>
          <br>
           </td> </tr> </table>
             <div align=”center”>
          <br>
          <input type=’Submit’ name=’submit’ value=’提交’>
          <input type=’reset’ name=’Reset’ value=’重写 ‘>
        </div>
      </form>

程序示例:
联系方式:webmaster@medguider.51.net
由于程序代码太多,这里只贴出部分重要代码。完整程序请到我的主页下载:

</BODY>
</HTML>
显示、删除成员:class/admin/member.php
<?
session_start();
if(!session_is_registered(“superlogin”))//检查是否注册
{
echo “<a
href=’../../superadmin.php’>请重新进行管理员登陆<BR>”;
exit;
}
include “../config.php”;
if ($del==1){
mysql_query(“delete from user where user=’$user'”,$db); //删除
echo “删除成功!”;}
?>
<html>
<head>
<title>成员列表</title>
<meta http-equiv=”Content-Type” content=”text/html;
charset=gb2312″>
</head>

配置部分:
数据库文件:class/mysql.txt
create table user (id char(2),user char(12),psw char(8),name char(8),sex
char(2),birth char(10),work varchar(50),ad varchar(50),post char(6),ph
varchar(30),bp varchar(20),email varchar(35),oicq char(12),photo
varchar(255),account varchar(255),count int(4) default ‘1’,signature
varchar(255),face int(2));
//成员资料表 id 记录号 user 用户名 psw 密码 name 姓名 sex 性别 birth
生日 work 工作单位 ad 通讯地址 post 邮编 ph 电话 bp 传呼 email 电子信箱
oicq oicq count 计数默认值为1
photo 个人照片 account 个人说明 signature 个人签名 face
头像(default=1)
create table notebook (user char(12),time char(30),ip varchar(16),title
varchar(255),nnote text);
//班级成员留言簿 user 用户名 time 时间 ip title 标题 nnote 内容
create table notebookg (name char(8),email varchar(35),time
char(30),face char(2),ip varchar(16),title varchar(255),nnote text);
//访客留言簿 name 姓名 email time 时间 face 头像 ip title 标题 nnote
内容
create table privatenote (id char(10),fromuser char(12),touser
char(12),time char(30),message text,look char(1) default ‘0’);
//悄悄话 id 记录号 fromuser 发消息人姓名 touser 接受人用户名  time
发出时间 message 信息 look 是否看过,默认值为0

<body bgcolor=”#FFFFFF” text=”#000000″>
<table width=”91%” border=”0″ cellspacing=”0″ cellpadding=”0″
height=”139″ align=”center”>
  <tr>  
    <td>  
      <div align=”center”><img src=”../image/classlogo.gif”
width=”224″ height=”60″></div>
    </td>
  </tr>
  <tr>
    <td height=”28″>
      <div align=”center”>成员列表</div>
    </td>
  </tr>
  <tr>  
    <td height=”163″>
      <table width=”95%” border=”1″ cellspacing=”1″
cellpadding=”0″>
        <tr>  
          <td>  
            <div align=”center”>用户名</div>
          </td>
          <td>
            <div align=”center”>密码</div>
          </td>
          <td>
            <div align=”center”>姓名</div>
          </td>
          <td>
            <div align=”center”>删除</div>
          </td>
        </tr>
        <?
          $result = mysql_query(“SELECT * FROM user”,$db);
          $row=mysql_num_rows($result);//查看结果有多少行
           for ($i=0;$i<=($row-1);$i++) {
   $name=mysql_result($result,$i,’name’);
   $user=mysql_result($result,$i,’user’);
   $psw=mysql_result($result,$i,’psw’);
   echo “<tr>”;
   echo “<td>$name</td>”;
   echo “<td>$psw</td>”;
   echo “<td>$name</td>”;
   echo “<td><a
href=’$PHP_SELF?del=1&user=$user’>删除</a></td>”;
   echo “</tr>”;  
        }
          ?>
        </table>
    </td>
  </tr>
</table>
</body>
</html>
修改成员资料:class/admin/editmember.php
<?
session_start();
if(!session_is_registered(“superlogin”))//检查是否注册
{
echo “<a
href=’../../superadmin.php’>请重新进行管理员登陆<BR>”;
exit;
}
?>
<html>
<head>
<title>修改成员资料</title>
<meta http-equiv=”Content-Type” content=”text/html;
charset=gb2312″>
</head>

配置文件:class/config.php
<?php
$sitename=”杏林同学录”;                 //站点名
$url=””;           //站点url
$db = mysql_connect(“localhost”,
“root”);//这里改为您的mysql用户名密码
mysql_select_db(“test”,$db);
$supervisor=”demo”;                      //超级管理员名
$superpsw=”demo”;                      //超级管理员密码
$superemail=”demo@demo.com”;//超级管理员email
$question1=”demo”;                      //注册提示问题1
$answer1=”demo”;                        //注册提示答案1
$question2=”demo”;                      //注册提示问题2
$answer2=”demo”;                        //注册提示答案2
?>

<body bgcolor=”#FFFFFF” text=”#000000″>
<form name=”form1″ method=”post” action=”editmember_step2.php”>
  <table width=”95%” border=”0″ cellspacing=”0″ cellpadding=”0″>
    <tr>  
      <td height=”117″ width=”49%”>  
        <div align=”center”>您要修改谁的资料?<br>
          <select name=”member”>
          <?php
            include “../config.php”;
            $result = mysql_query(“SELECT * FROM user”,$db);
            $row=mysql_num_rows($result);//查看结果有多少行,即成员人数
            for ($i=0;$i<=($row-1);$i++){
             $name=mysql_result($result,$i,’name’);
             echo “<option>”,$name,”</option>”;
            }
          ?>             
          </select>
          <br>
          <input type=”submit” name=”Submit” value=”确定”>
          <input type=”reset” name=”cancel” value=”重置”>
        </div>
      </td>
    </tr>
  </table>
</form>
</body>
</html>
修改成员资料步骤2:class/admin/editmember_step2.php
<?
session_start();
if(!session_is_registered(“superlogin”))//检查是否注册
{
echo “<a
href=’../../superadmin.php’>请重新进行管理员登陆<BR>”;
exit;
}
?>
<HTML>
<HEAD>
<meta http-equiv=”Content-Type” content=”text/html;
charset=gb2312″>
<TITLE>修改成员资料</TITLE>
</HEAD>
<BODY BGCOLOR=”#FFFFFF”>
<?php
include “../config.php”;
if ($submit){
$user=trim($username);
$psw=trim($psw);
$name=trim($name);
$birth=trim($birth);
$work=trim($work);
$ad=trim($ad);
$post=trim($post);
$ph=trim($ph);
$bp=trim($bp);
$email=trim($email);
$oicq=trim($oicq);
$photoname=trim($photoname);
$account=strip_tags(trim($account));//去掉首尾空格及html标记
$signature=strip_tags(trim($signature));
//写入数据库
$sql=”UPDATE user SET
user=’$user’,psw=’$psw’,name=’$name’,sex=’$sex’,birth=’$birth’,work=’$work’,ad=’$ad’,post=’$post’,ph=’$ph’,bp=’$bp’,email=’$email’,oicq=’$oicq’,account=’$account’,signature=’$signature’,photo=’$photoname’,face=’$face’
where name=’$member'”;
$result = mysql_query($sql,$db);
mysql_close($db);
echo “恭喜您修改成功!”;
exit;
}
$result = mysql_query(“SELECT * FROM user where
name=’$member'”,$db);
$user=mysql_result($result,0,”user”);
$psw=mysql_result($result,0,”psw”);
$sex=mysql_result($result,0,”sex”);
$birth=mysql_result($result,0,”birth”);
$work=mysql_result($result,0,”work”);
$ad=mysql_result($result,0,”ad”);
$post=mysql_result($result,0,”post”);
$ph=mysql_result($result,0,”ph”);
$bp=mysql_result($result,0,”bp”);
$email=mysql_result($result,0,”email”);
$oicq=mysql_result($result,0,”oicq”);
$photo=mysql_result($result,0,”photo”);
$account=mysql_result($result,0,”account”);
$signature=mysql_result($result,0,”signature”);
$photo=mysql_result($result,0,”photo”);
$face=mysql_result($result,0,”face”);
mysql_close($db);
?>
<table width=’95%’ border=’0′ cellspacing=’0′ cellpadding=’0′
align=’center’>
  <tr>  
    <td colspan=”2″>  
      <div align=”center”><img src=”../image/classlogo.gif”
width=”224″ height=”60″></div>
    </td>
  </tr>
  <tr>  
    <td>  
      <div align=”center”>修改成员资料</div>
    </td>
  </tr>
  <tr>  
    <td colspan=”2″>  
      <form method=’post’ action='<? echo
$PHP_SELF,’?member=’,$member;?>’>
        <table width=”95%” border=”1″ cellspacing=”1″ cellpadding=”0″
align=”center” bordercolor=”#FFCC00″>
          <tr>
            <td height=”153″ width=”60%”><br>
              用户名:  
              <input type=’Text’ name=’username’ size=’12’
maxlength=’12’ value=”<? echo $user;?>”>
              <br>
              (英文字母或加数字,长度不超过12)<br>
          密码:  
          <input type=’password’ name=’psw’ size=’8′ maxlength=’8′
value=”<? echo $psw; ?>”>
              <br>
              (英文字母或加数字,长度不超过8个字符)<br>
          姓名:  
          <input type=’Text’ name=’name’ size=’8′ maxlength=’8′
value=”<? echo $member; ?>”>
          *<br>
          性别:男  
          <input type=’radio’ name=’sex’ value=’男’ <? if
($sex==’男’){echo “checked”;} ?>>
          女  
          <input type=’radio’ name=’sex’ value=’女’ <? if
($sex==’女’){echo “checked”;} ?>>
          <br>
          生日:<input type=”text” name=”birth” size=”12″
maxlength=”12″ value=”<? echo $birth; ?>”><br>
          工作单位:  
          <input type=’Text’ name=’work’ size=’30’ maxlength=’50’
value=”<? echo $work; ?>”>
          <br>
          通讯地址:  
          <input type=’Text’ name=’ad’ size=’30’ maxlength=’50’
value=”<? echo $ad; ?>”>
              <br>
          邮编:  
          <input type=’Text’ name=’post’ size=’6′ maxlength=’6′
value=”<? echo $post; ?>”>
          <br>
          电话:  
          <input type=’Text’ name=’ph’ size=’15’ maxlength=’30’
value=”<? echo $ph; ?>”>
              <br>
          传呼:  
          <input type=’Text’ name=’bp’ size=’15’ maxlength=’20’
value=”<? echo $bp; ?>”>
          <br>
          Email:  
          <input type=’Text’ name=’email’ size=’15’ maxlength=’35’
value=”<? echo $email; ?>”>
              <br>
          oicq:  
          <input type=’Text’ name=’oicq’ size=’12’ maxlength=’12’
value=”<? echo $oicq; ?>”>
              <br>
              个人照片:
              <input type=’text’ name=’photoname’ value=”<? echo
$photo; ?>”>
              <br>
          个人说明:(在通讯录里显示,不超过125个汉字)<BR>
          <textarea name=’account’ cols=’50’ rows=’5′><? echo
$account; ?></textarea>
          <br>
          个人签名:(在留言簿的自动签名,不超过125个汉字)<br>
              <textarea name=”signature” cols=”50″ rows=”5″><?
echo $signature; ?></textarea>
            </td>
            <td height=”153″ width=”40%”><br>
              选择一个自己喜欢的头像:<br>
          <?
           for ($i=1;$i<=64;$i++){
            echo “<img src=’../image/face/icon”.$i.”.gif’ width=’32’
height=’32’>”;  
            echo “<input type=’radio’ name=’face’ value=’$i’ “;
            if ($face==$i){
            echo “checked”;
            }
            echo “>”;
            if (($i%4)==0){ //隔4行,换行
             echo “<br>”;
            }
           }
           ?><br>
            </td>
          </tr>
        </table>
        <div align=”center”>
          <br>
          <input type=’Submit’ name=’submit’ value=’提交’>
          <input type=’reset’ name=’Reset’ value=’重写 ‘>
        </div>
      </form>
    </td>
  </tr>
</table>
</BODY>
</HTML> 

主程序:
  登陆首页:index.php
<html>
<head>
<title>班级成员登录</title>
<meta http-equiv=”Content-Type” content=”text/html;
charset=gb2312″>
<style type=”text/css”>
<!–
.deepblue10 {  font-family: “宋体”; font-size: 10pt; color: #3333FF;
text-decoration: none}
A.purple:hover {  font-size: 9pt; color: #3366FF; background-color:
#99FFFF; text-decoration: none}
A.purple:link {  font-size: 10pt; text-decoration: none}
a:hover {  text-decoration: none}
a:visited {  text-decoration: none}
–>
</style>
</head>

<body bgcolor=”#FFFFFF”>
<table width=”75%” border=”0″ cellspacing=”0″ cellpadding=”0″
align=”center”>
  <tr>  
    <td>  
      <div align=”center”><img src=”class/image/classlogo.gif”
width=”224″ height=”60″></div>
    </td>
  </tr>
  <tr>
    <td height=”48″> </td>
  </tr>
  <tr>  
    <td>  
      <table width=”75%” border=”1″ cellspacing=”0″ cellpadding=”0″
align=”center” bordercolorlight=”#FF9900″ bordercolordark=”#FFFFFF”
class=”deepblue10″>
        <tr>  
          <td colspan=”2″>  
            <div align=”center”></div>
          </td>
        </tr>
        <tr>  
          <td width=”33%” height=”17″>  
            <div align=”center”>班级成员登录 </div>
          </td>
          <td width=”67%” height=”17″>  
            <div align=”center”><a
href=”class/register_step1.php”
class=”purple”>班级成员注册</a></div>
          </td>
        </tr>
        <tr>  
          <td width=”33%” rowspan=”2″>  
            <form method=”post” action=”main.php”>
              <div align=”center”>用户名  
                <input type=”text” name=”username” size=”8″
maxlength=”8″>
                <br>
                密码   
                <input type=”password” name=”userpsw” size=”8″
maxlength=”8″>
                <br>
                <br>
                <input type=”submit” name=”Submit” value=”登录”>
                <input type=”reset” name=”cancel” value=”重写”>
              </div>
            </form>
          </td>
          <td width=”67%” height=”21″>  
            <div align=”center”><a
href=”class/guest.php”>客人访问</a></div>
          </td>
        </tr>
        <tr>  
          <td width=”67%”>  
            <div align=”center”>
              <p>忘了密码:<a href=”class/querypsw.php”
class=”deepblue10″>向管理员索要密码</a><br>
                </p>
                        </div>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html> 

相关文章