杏林同学录(八)


Posted in PHP onOctober 09, 2006

班级管理部分:
   首页: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>

<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;?>'>

  <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>

</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>

<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>

<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> 

PHP 相关文章推荐
我的论坛源代码(一)
Oct 09 PHP
mysql4.1以上版本连接时出现Client does not support authentication protocol问题解决办法
Mar 15 PHP
php 破解防盗链图片函数
Dec 09 PHP
php 正则匹配函数体
Aug 25 PHP
PHPMailer 中文使用说明小结
Jan 22 PHP
以实例全面讲解PHP中多进程编程的相关函数的使用
Aug 18 PHP
Laravel中注册Facades的步骤详解
Mar 16 PHP
php原生导出excel文件的两种方法(推荐)
Nov 19 PHP
yii2中LinkPager增加总页数和总记录数的实例
Aug 28 PHP
PHP使用Redis长连接的方法详解
Feb 12 PHP
thinkPHP5框架实现多数据库连接,跨数据连接查询操作示例
May 29 PHP
Centos7 Yum安装PHP7.2流程教程详解
Jul 02 PHP
PHP的FTP学习(四)
Oct 09 #PHP
杏林同学录(七)
Oct 09 #PHP
一个连接两个不同MYSQL数据库的PHP程序
Oct 09 #PHP
我的论坛源代码(一)
Oct 09 #PHP
我的论坛源代码(二)
Oct 09 #PHP
我的论坛源代码(三)
Oct 09 #PHP
我的论坛源代码(四)
Oct 09 #PHP
You might like
PHP中对用户身份认证实现两种方法
2011/06/04 PHP
Codeigniter实现处理用户登录验证后的URL跳转
2014/06/12 PHP
Thinkphp 框架扩展之应用模式实现方法分析
2020/04/27 PHP
javascript各种复制代码收集
2008/09/20 Javascript
JavaScript 小型打飞机游戏实现原理说明
2010/10/28 Javascript
快速解决Canvas.toDataURL 图片跨域的问题
2016/05/10 Javascript
javascript实现任务栏消息提示的简单实例
2016/05/31 Javascript
原生js三级联动的简单实现代码
2016/06/07 Javascript
jquery+css实现简单的图片轮播效果
2017/08/07 jQuery
Node Puppeteer图像识别实现百度指数爬虫的示例
2018/02/22 Javascript
vue计算属性及使用详解
2018/04/02 Javascript
详解写好JS条件语句的5条守则
2019/02/28 Javascript
vue双向绑定及观察者模式详解
2019/03/19 Javascript
layui清除radio的选中状态实例
2019/11/14 Javascript
基于JS正则表达式实现模板数据动态渲染(实现思路详解)
2020/03/07 Javascript
VUE-ElementUI 自定义Loading图操作
2020/11/11 Javascript
Vant+postcss-pxtorem 实现浏览器适配功能
2021/02/05 Javascript
python设置检查点简单实现代码
2014/07/01 Python
解决python中遇到字典里key值为None的情况,取不出来的问题
2018/10/17 Python
Window环境下Scrapy开发环境搭建
2018/11/18 Python
使用python实现哈希表、字典、集合操作
2019/12/22 Python
详解python UDP 编程
2020/08/24 Python
python飞机大战游戏实例讲解
2020/12/04 Python
商务助理岗位职责
2013/11/13 职场文书
后勤人员岗位职责
2013/12/17 职场文书
优秀求职信
2014/05/29 职场文书
暑期学习心得体会
2014/09/02 职场文书
个人遵守党的政治纪律情况对照检查材料思想汇报
2014/09/25 职场文书
村党支部对照检查材料思想汇报
2014/09/28 职场文书
王兆力在市委党的群众路线教育实践活动总结大会上的讲话稿
2014/10/25 职场文书
2014年外联部工作总结
2014/11/17 职场文书
大客户经理岗位职责
2015/04/09 职场文书
2015年度公共机构节能工作总结
2015/05/26 职场文书
2019年公司卫生管理制度样本
2019/08/21 职场文书
css常用字体属性与背景属性介绍
2022/02/28 HTML / CSS
MySQL详细讲解变量variables的用法
2022/06/21 MySQL