PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/modify_disabled.php

https://bitbucket.org/swallow13/online_exam_system
PHP | 30 lines | 23 code | 3 blank | 4 comment | 9 complexity | 66a1f6b5c12cf9e56215bd5fe8b11e9c MD5 | raw file
  1. <?php
  2. /**
  3. * @Alex Ai swallow13@163.com
  4. * @copyright 2009
  5. */
  6. require_once("../include/auth_a.php");
  7. require_once("../include/config.php");
  8. $lvl = $_GET['lvl'];
  9. $id = $_GET['id'];
  10. if ($lvl == 's') {
  11. $qr = mysql_query("SELECT `disabled` FROM `gb_students_tb` WHERE `stu_id` = '$id';");
  12. if (mysql_result($qr,0) == 'yes') {
  13. mysql_query("UPDATE `gb_students_tb` SET `disabled` = 'no' WHERE `stu_id` = '$id';");
  14. } else {
  15. mysql_query("UPDATE `gb_students_tb` SET `disabled` = 'yes' WHERE `stu_id` = '$id';");
  16. }
  17. } elseif ($lvl == 't') {
  18. $qr = mysql_query("SELECT `disabled` FROM `gb_teachers_tb` WHERE `tea_id` = '$id';");
  19. if (mysql_result($qr,0) == 'yes') {
  20. mysql_query("UPDATE `gb_teachers_tb` SET `disabled` = 'no' WHERE `tea_id` = '$id';");
  21. } else {
  22. mysql_query("UPDATE `gb_teachers_tb` SET `disabled` = 'yes' WHERE `tea_id` = '$id';");
  23. }
  24. }
  25. mysql_close();
  26. header("location:effect.php");
  27. ?>