班级管理部分:
首页: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;
}
?>
班级管理
|
班级管理 |
添加成员 显示、删除成员 修改成员信息 班级留言管理 客人留言管理 |
添加成员:class/admin/addmember.php
session_start();
if(!session_is_registered("superlogin"))//检查是否注册
{
echo "请重新进行管理员登陆
";
exit;
}
include "../config.php";
if ($submit){
if (!$username||!$name){ //检查是否填写完整
echo "对不起,您必须填所有带*的项目!
"."返回";
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 "此名字已有人注册!"."重新填写 "."忘记密码,向管理员索要密码";
exit;
}
//检验用户名是否被使用
$result = mysql_query("SELECT user FROM user where user='$username'",$db);//若返回列的数目不为0,说明此用户名已有人使用
if (mysql_num_rows($result)!=0){
echo "此用户名已有人使用!"."重新填写";
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 "删除成功!";}
?>
成员列表
|
成员列表 |
用户名 | 密码 | 姓名 | 删除 | $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教程有兴趣的朋友有所帮助。