Xinglin classmates (8)_PHP tutorial

WBOY
Release: 2016-07-21 16:04:04
Original
913 people have browsed it

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

";
echo "
请输入管理员密码
";
echo "管理员";  
echo "
";
echo "密码";
echo "
";
echo "
";
echo "
";   
echo "
";
exit;
}
?>


班级管理




 



    
    
  
    
    
  
    
    
  

      

    
  
      
班级管理

    
  
      

        添加成员

        显示、删除成员

        修改成员信息

        班级留言管理

        客人留言管理

                                                                     /addmember.php
session_start();
if(!session_is_registered("superlogin"))//Check whether it is registered
{
echo "Please log in as administrator again
";
exit;
}
include "../config.php";
if ($submit){
if (!$username||!$name){                                                                                           ‐                                                                                                                                                                                     { ;a href='javascript:history.back()'>Return
";
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);
//Check whether this name has been registered
$result = mysql_query("SELECT name FROM user where name='$name'",$db);
if (mysql_num_rows($result)!=0){
echo "This name has already been registered! "."Refill "."Forgot your password? Ask the administrator for password";
exit;
}
//Check whether the user name is used
$result = mysql_query("SELECT user FROM user where user='$username'",$db);//If the number of columns returned is not 0, indicating that this username is already used.
if (mysql_num_rows($result)!=0){
echo "This username is already used!"."重新填写";
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;
}
?>



添加成员




  
    
            


              用户名:  
              
              *

              (英文字母或加数字,长度不超过12)

          密码:  
          
              

              (英文字母或加数字,长度不超过8个字符)

          姓名:  
          
          *

          性别:男  
          
          女  
          
          

          生日:  
          
          年  
          
          月  
          
          日

          工作单位:  
          
          

          通讯地址:  
          
          

          邮编:  
          
          

          电话:  
          
          

          传呼:  
          
          

          Email:  
          
          

          oicq:  
          
          

           

             

          

          
          
        

      





显示、删除成员:class/admin/member.php
session_start();
if(!session_is_registered("superlogin"))//检查是否注册
{
echo "请重新进行管理员登陆
";
exit;
}
include "../config.php";
if ($del==1){
mysql_query("delete from user where user='$user'",$db); //删除
echo "删除成功!";}
?>


成员列表





    
    
  
  
    
  
    
    
  
  
      

    

      
成员列表

    

      
          
          
          
          
          
        
                  $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 "";
   echo "";
   echo "";
   echo "";
   echo "";
   echo "";  
        }
          ?>
        
  
            
用户名

          

            
密码

          

            
姓名

          

            
删除

          
$name$psw$name删除

    



修改成员资料:class/admin/editmember.php
session_start();
if(!session_is_registered("superlogin"))//检查是否注册
{
echo "
请重新进行管理员登陆
";
exit;
}
?>


修改成员资料





  
      
      
    
  
  
        
您要修改谁的资料?

          
          

          
          
        

      




修改成员资料步骤2:class/admin/editmember_step2.php
session_start();
if(!session_is_registered("superlogin"))//检查是否注册
{
echo "
请重新进行管理员登陆
";
exit;
}
?>



修改成员资料


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

    
    
  
    
                                                          ''>
            
  
      

    
  
      
修改成员资料

        
🎜>                                                                                                                                                >                                                                                                                                                                                                 "">
                                                                                                                                                                                               
*

Gender: Male
   
                                                                                                                                                                 ?>>
          

          生日:

          工作单位:  
          
          

          通讯地址:  
          
              

          邮编:  
          
          

          电话:  
          
              

          传呼:  
          
          

          Email:  
          
              

          oicq:  
          
              

              个人照片:
              
              

          个人说明:(在通讯录里显示,不超过125个汉字)

          
          

          个人签名:(在留言簿的自动签名,不超过125个汉字)

              
            
            
          
        


              选择一个自己喜欢的头像:

                     for ($i=1;$i<=64;$i++){
            echo "";  
            echo "            if ($face==$i){
            echo "checked";
            }
            echo ">";
            if (($i%4)==0){ //隔4行,换行
             echo "
";
            }
           }
           ?>

            

        

          

          
          
        

      
    


 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/316062.htmlTechArticle班级管理部分: 首页:superadmin.php ?php include (class/config.php); if ($superadmin){//如果已经进行管理员登陆,进行密码验证 if (!($supername==$superviso...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template