Home >Backend Development >PHP Tutorial >Xinglin classmates (8)_PHP tutorial
班级管理部分:
首页: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 "
| |||||||||||||||
班级管理 | |||||||||||||||
/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; } ?> 显示、删除成员: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 "删除成功!";} ?>
修改成员资料: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); ?>
Statement: 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 Previous article:Xinglin classmates (5)_PHP tutorialNext article:Xinglin classmates (5)_PHP tutorial Related articlesSee more |