/admin/admin_reg.php
PHP | 58 lines | 50 code | 4 blank | 4 comment | 6 complexity | 0e9bc6b02d56039ac4ca149f99aa914f MD5 | raw file
- <?php
-
- /**
- * @author
- * @copyright 2010
- */
- require_once("../include/auth_a.php");
- require_once("../include/config.php");
-
- function prt_tb($a,$b) {
- echo '
- <table width=300 border=1 cellspacing=0 cellpadding=5 bordercolor=#ffffff bordercolorlight=#000000>
- <tr>
- <td> </td>
- <td>是否允许注册</td>
- <td> </td>
- </tr>
- <tr>
- <td>Student</td>
- <td>'.$a.'</td>
- <td><a href="javascript:showtb(\'stu\')">更改</a></td>
- </tr>
- <tr>
- <td>Teacher</td>
- <td>'.$b.'</td>
- <td><a href="javascript:showtb(\'tea\')">更改</a></td>
- </tr>
- </table>
- ';
- }
-
- $stu_stat = mysql_result(mysql_query("SELECT `stat` FROM `gb_reg_stat` WHERE `type` = 'stu';"),0,0);
- $tea_stat = mysql_result(mysql_query("SELECT `stat` FROM `gb_reg_stat` WHERE `type` = 'tea';"),0,0);
-
- if ($_GET['type'] = 'all') {
- prt_tb($stu_stat,$tea_stat);
- } elseif ($_GET['type'] = 'stu') {
- if ($stu_stat = 'yes') {
- mysql_query("UPDATE `gb_reg_stat` SET `stat` = 'no' WHERE `type` = 'stu';");
- $stu_stat = 'no';
- } else {
- mysql_query("UPDATE `gb_reg_stat` SET `stat` = 'yes' WHERE `type` = 'stu';");
- $stu_stat = 'yes';
- }
- prt_tb($stu_stat,$tea_stat);
- } elseif ($_GET['type'] = 'tea') {
- if ($tea_stat = 'yes') {
- mysql_query("UPDATE `gb_reg_stat` SET `stat` = 'no' WHERE `type` = 'tea';");
- $tea_stat = 'no';
- } else {
- mysql_query("UPDATE `gb_reg_stat` SET `stat` = 'yes' WHERE `type` = 'tea';");
- $tea_stat = 'no';
- }
- prt_tb($stu_stat,$tea_stat);
- } else {
- echo "Something wrong";
- }
- ?>