⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exitclass.php3

📁 网络同学录程序
💻 PHP3
字号:
<?
/*大家好,我是豆腐
提供原码是我的一贯原则,但是希望大家能够尊重豆腐的工作
希望大家在使用的过程中随时和我联系 roboo@21cn.com
您可以随意修改代码,但是请保留我的注释(如果不保留,我也没办法)
如果您觉得这个程序对您有或多或少的帮助,豆腐希望能够得到您的鼓励
您的鼓励和支持,是我们工作的最大动力
    .  =======
   / \| O   O |
   \ /  \v_'/
    #   _| |_
   (#) (     )
    #\//|* *|\\
    #\/(  *  )/       //豆腐制作,都是精品
    #   =====
    #   (\ /)
    #   || ||
   .#---'| |----.
    #----' -----'
    //哲人说:用我的心换你的心,我们便拥有两颗心
*/
?>
<?
  include("conn.php3");
  include("db.php3");
  include("userfunc.php3");
  $conn=openconn();
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="class.css">
<title>从本班级中删除自己</title>
</head>
<BODY>
<? if($cmdDo=="" and $cmdDel=="" and $cmdDelClass==""){?>
<form method="post">
<?
  $SQL="select * from " . $DataBaseOwerName . ".class_class where classid='" . $classid . "'";
  $stmt1=opensql($conn,$SQL);
  $stmt=fecthrow($stmt1);
  if(getcolumn($stmt,"MANAGERID")==$userid){
     if(getcolumn($stmt,"REGNUM")==1)
      {
        echo "<p>对不起,您目前所在的班级只有您一个人,因此您的退出将导致系统删除您的班级</p>";
        ?>
          <input type=submit value="确定" name="cmdDelClass" class=buttonface>
        <?
        exit;
      }
     echo "<p>对不起,您是这个班级的管理员,在您注销之前,请选择新的班级管理员!</p>";
     ?>
         <?
           $SQL="select * from " . $DataBaseOwerName . ".class_userRelation,Class_classuser where class_userRelation.classid='" . $classid . "' and class_userRelation.userid=Class_classuser.userid and Class_classuser.userid<>'" . $userid . "'";
           $stmt1=openSQL($conn,$SQL);
         ?>
         <SELECT name="selManager" class=selectface>
            <? while($stmt=fecthrow($stmt1)){ ?>
            <option value=<?echo getcolumn($stmt,"USERID");?>><?echo getcolumn($stmt,"USERNAME");?></option>
            <?}?>
         </select><br>
         <input type=submit name="cmdDo" value="确定" class=buttonface>
       </form>
     <?
     exit;
  }
?>
  <p class=biggerfont>真的要注销自己在<?echo $classid?> 中的身份吗?</p>
  <input type=submit name="cmdDel" value="确定" class=buttonface>
  </form>
<?
  exit;
}
?>
<?
  if($cmdDo!=""){
    //确定选定的用户是本班的管理员
    $SQL="update " . $DataBaseOwerName . ".class_class set ManagerID='" . $selManager . "' where classid='" . $classid . "'";
    $stmt=openSql($conn,$SQL);
    $SQL="delete from " . $DataBaseOwerName . ".Class_userRelation where userid='" . $userid . "' and classid='" . $classid . "'";
    $stmt=opensql($conn,$SQL);
    $SQL="Update " . $DataBaseOwerName . ".CLASS_SCHOOL set CLASSNUM=CLASSNUM - 1 where SCHOOLID=(select SCHOOLID from CLASS_CLASS where  classid='" . $classid . "')";
    $stmt=opensql($conn,$SQL);
    $SQL="Update " . $DataBaseOwerName . ".Class_Class set regNum=regNum - 1 where classid='" . $classid . "'";
    $stmt=opensql($conn,$SQL);
    echo "现在" . $classid . "的管理员是" . $selManager . "您现在已经不在" . $classid . "班级中,但是您的用户名仍然有效!";
  }
?>
<?
  if($cmdDel!=""){
    $SQL="delete from " . $DataBaseOwerName . ".Class_userRelation where userid='" . $userid . "' and classid='" . $classid . "'";
    $stmt=opensql($conn,$SQL);
    $SQL="Update " . $DataBaseOwerName . ".CLASS_SCHOOL set CLASSNUM=CLASSNUM - 1 where SCHOOLID=(select SCHOOLID from CLASS_CLASS where  classid='" . $classid . "')";
    $stmt=opensql($conn,$SQL);
    $SQL="Update " . $DataBaseOwerName . ".Class_Class set regNum=regNum - 1 where classid='" . $classid . "'";
    echo $SQL;
    $stmt=opensql($conn,$SQL);
    echo "您现在已经不在" . $classid . "班级中,但是您的用户名仍然有效!";
  }
?>
<?
  if($cmdDelClass!=""){
    $SQL="delete from " . $DataBaseOwerName . ".Class_userRelation where userid='" . $userid . "' and classid='" . $classid . "'";
    $stmt=opensql($conn,$SQL);
    $SQL="select SCHOOLID from CLASS_CLASS where  classid='" . $classid . "'";
    $stmt=opensql($conn,$SQL);
    $stmt=fecthrow($stmt);
    $SQL="Update " . $DataBaseOwerName . ".CLASS_SCHOOL set CLASSNUM=CLASSNUM - 1 where SCHOOLID=" . getcolumn($stmt,"schoolid");
    $stmt=opensql($conn,$SQL);
    $SQL="delete from " . $DataBaseOwerName . ".Class_Class  where classid='" . $classid . "'";
    $stmt=opensql($conn,$SQL);
    echo "您现在已经不在" . $classid . "班级中,但是您的用户名仍然有效!";
  }
?>
</form>
</BODY>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -