班级管理部分:
首页: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 "
";
exit;
}
?>
班级管理
Add members: class/admin/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){ //Check whether it is completed
All items with * must be filled in!
"."Return";
exit 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 the password< /a>";
exit;
}
//Check whether the user name is used
$result = mysql_query("SELECT user FROM user where user='$username'",$db);//If the number of columns is returned If it is not 0, it means that this username has already been used.
if (mysql_num_rows($result)!=0){
echo "This username has already been used!""."Refill";
exit;
}
//Write to database
$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 "Added successfully ";
exit;
}
?>
Add member 显示、删除成员: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 "$name | "; echo "$psw | "; echo "$name | "; echo "删除 | "; 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);
$phot
$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);
?>
以上就介绍了 杏林同学录八,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。