PageRenderTime 57ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/admin_reg.php

https://bitbucket.org/swallow13/online_exam_system
PHP | 58 lines | 50 code | 4 blank | 4 comment | 6 complexity | 0e9bc6b02d56039ac4ca149f99aa914f MD5 | raw file
  1. <?php
  2. /**
  3. * @author
  4. * @copyright 2010
  5. */
  6. require_once("../include/auth_a.php");
  7. require_once("../include/config.php");
  8. function prt_tb($a,$b) {
  9. echo '
  10. <table width=300 border=1 cellspacing=0 cellpadding=5 bordercolor=#ffffff bordercolorlight=#000000>
  11. <tr>
  12. <td>&nbsp;</td>
  13. <td>是否允许注册</td>
  14. <td>&nbsp;</td>
  15. </tr>
  16. <tr>
  17. <td>Student</td>
  18. <td>'.$a.'</td>
  19. <td><a href="javascript:showtb(\'stu\')">更改</a></td>
  20. </tr>
  21. <tr>
  22. <td>Teacher</td>
  23. <td>'.$b.'</td>
  24. <td><a href="javascript:showtb(\'tea\')">更改</a></td>
  25. </tr>
  26. </table>
  27. ';
  28. }
  29. $stu_stat = mysql_result(mysql_query("SELECT `stat` FROM `gb_reg_stat` WHERE `type` = 'stu';"),0,0);
  30. $tea_stat = mysql_result(mysql_query("SELECT `stat` FROM `gb_reg_stat` WHERE `type` = 'tea';"),0,0);
  31. if ($_GET['type'] = 'all') {
  32. prt_tb($stu_stat,$tea_stat);
  33. } elseif ($_GET['type'] = 'stu') {
  34. if ($stu_stat = 'yes') {
  35. mysql_query("UPDATE `gb_reg_stat` SET `stat` = 'no' WHERE `type` = 'stu';");
  36. $stu_stat = 'no';
  37. } else {
  38. mysql_query("UPDATE `gb_reg_stat` SET `stat` = 'yes' WHERE `type` = 'stu';");
  39. $stu_stat = 'yes';
  40. }
  41. prt_tb($stu_stat,$tea_stat);
  42. } elseif ($_GET['type'] = 'tea') {
  43. if ($tea_stat = 'yes') {
  44. mysql_query("UPDATE `gb_reg_stat` SET `stat` = 'no' WHERE `type` = 'tea';");
  45. $tea_stat = 'no';
  46. } else {
  47. mysql_query("UPDATE `gb_reg_stat` SET `stat` = 'yes' WHERE `type` = 'tea';");
  48. $tea_stat = 'no';
  49. }
  50. prt_tb($stu_stat,$tea_stat);
  51. } else {
  52. echo "Something wrong";
  53. }
  54. ?>