PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/mark.php

https://bitbucket.org/swallow13/online_exam_system
PHP | 110 lines | 96 code | 6 blank | 8 comment | 10 complexity | 520e62e8798c848feddb535b68a9e3d6 MD5 | raw file
  1. <?php
  2. /**
  3. * @Alex Ai swallow13@163.com
  4. * @copyright 2009
  5. */
  6. require_once("../include/auth_t.php");
  7. require_once("../include/config.php");
  8. require("../include/funs.php");
  9. include("../include/head.htm");
  10. $pid = $_GET['pid'];
  11. $myqr = mysql_query("SELECT `priv_mark` FROM `gb_papers_warehouse` WHERE `paper_id` = '$pid';");
  12. $whomark = explode(',',mysql_result($myqr,0,0));
  13. if (in_array($_SESSION['gid'],$whomark) == false) {
  14. echo '<script>alert("You have no privilege to mark it");window.location.href="index.php";</script>';
  15. exit;
  16. }
  17. $qr1 = mysql_query("SELECT `items_ids` FROM `gb_papers_warehouse` WHERE `paper_id` = '$pid';");
  18. $group_ids = mysql_result($qr1,0);
  19. $group_ids = explode(",",$group_ids);
  20. foreach ($group_ids as $v) {
  21. $qr2 = mysql_query("SELECT `item_type` FROM `gb_items_warehouse` WHERE `item_id` = '$v';");
  22. $type = mysql_result($qr2,0);
  23. switch ($type) {
  24. case 3:
  25. $tiankong[] = $v;
  26. $_SESSION['tk'] = $tiankong;
  27. break;
  28. case 4:
  29. $jianda[] = $v;
  30. $_SESSION['jd'] = $jianda;
  31. break;
  32. }
  33. }
  34. echo '<form method="post" action="count.php">';
  35. $arr_aid = array();
  36. foreach ($tiankong as $u) {
  37. $qr7 = mysql_query("SELECT `item_score` FROM `gb_items_warehouse` WHERE `item_id` = '$u';");
  38. $score = mysql_result($qr7,0);
  39. $stem ='';
  40. $qr3 = mysql_query("SELECT * FROM `gb_item_type3` WHERE `item_id` = '$u' ORDER BY `sort_num`;");
  41. echo '<table border=1 cellpadding=8 width=85% bgcolor=#999999><tr><td>';
  42. while ($row = mysql_fetch_array($qr3)) {
  43. if ($row[3] == 0) {
  44. $stem .= $row[2];
  45. } else {
  46. $qr4 = mysql_query("SELECT `reffer` FROM `gb_item_type3_reffer` WHERE `item_id` = '$row[0]' AND `sort_num` = '$row[1]';");
  47. $re = '&#x53C2;&#x8003;&#x7B54;&#x6848;:'.mysql_result($qr4,0);
  48. $stem .= '&nbsp;<input type=text class=blank value="'.$re.'" disabled />&nbsp;';
  49. }
  50. }
  51. echo $stem.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5206;&#x503C; '.$score.' &#x5206;';
  52. echo '</td></tr></table>';
  53. $qr5 = mysql_query("SELECT `id` FROM `gb_answer_papers` WHERE `paper_id` = '$pid' AND `status` = '0';");
  54. echo '<table border=1 cellpading=8 width=85%>';
  55. while ($an_id = mysql_fetch_array($qr5)) {
  56. $an_blk = '';
  57. $qr6 = mysql_query("SELECT `answ` FROM `gb_sub_answ` WHERE `id`= '$an_id[0]' AND `item_id` = '$u';");
  58. echo '<tr><td>';
  59. while ($w = mysql_fetch_array($qr6)) {
  60. $an_blk .= '&nbsp;<input type=text value="'.$w[0].'" disabled />&nbsp;';
  61. }
  62. echo '&#x56DE;&#x7B54;&#xFF1A;'.$an_blk;
  63. echo '</td><td>';
  64. //echo '&#x5F97;&#x5206;&#xFF1A;<input type=text class=short name="tk-aid'.$an_id[0].'[]" value="0" onkeyup="value=value.replace(/[^\d]/g,\'\')" onchange="document.getElementById(\'h-'.$an_id[0].'-'.$u.'\').value=value;" />';
  65. //echo '<input type=hidden id="h-'.$an_id[0].'-'.$u.'" name="h-'.$an_id[0].'-'.$u.'" value="" />';
  66. echo '&#x5F97;&#x5206;&#xFF1A;<input type=text class=short name="tk-'.$an_id[0].'-'.$u.'" value="0" onkeyup="value=value.replace(/[^\d]/g,\'\')"';
  67. echo '</td></tr>';
  68. $arr_aid[] = $an_id[0];
  69. }
  70. echo '</table><br />';
  71. }
  72. foreach ($jianda as $x) {
  73. $qr8 = mysql_query("SELECT `item_score` FROM `gb_items_warehouse` WHERE `item_id` = '$x';");
  74. $score = mysql_result($qr8,0);
  75. $qr9 = mysql_query("SELECT * FROM `gb_item_type4` WHERE `item_id` = '$x';");
  76. echo '<table border=1 cellpadding=8 width=85% bgcolor=#999999><tr><td>';
  77. echo '<p>'.mysql_result($qr9,0,1).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#x5206;&#x503C; '.$score.' &#x5206;';
  78. echo '<p>&#x53C2;&#x8003;&#x7B54;&#x6848;:<br />'.mysql_result($qr9,0,2).'</p>';
  79. echo '</td></tr></table>';
  80. $qr10 = mysql_query("SELECT `id` FROM `gb_answer_papers` WHERE `paper_id` = '$pid' AND `status` = '0';");
  81. echo '<table border=1 cellpading=8 width=85%>';
  82. while ($an_id = mysql_fetch_array($qr10)) {
  83. echo '<tr><td>';
  84. $qr11 = mysql_query("SELECT `answ` FROM `gb_sub_answ` WHERE `id`= '$an_id[0]' AND `item_id` = '$x';");
  85. echo '&#x56DE;&#x7B54;&#xFF1A;<br />'.mysql_result($qr11,0);
  86. echo '</td><td>';
  87. //echo '&#x5F97;&#x5206;&#xFF1A;<input type=text class=short name="jd-aid'.$an_id[0].'[]" value="0" onkeyup="value=value.replace(/[^\d]/g,\'\')" onchange="document.getElementById(\'h-'.$an_id[0].'-'.$x.'\').value=value;" />';
  88. //echo '<input type=hidden id="h-'.$an_id[0].'-'.$x.'" name="h-'.$an_id[0].'-'.$x.'" value="" />';
  89. echo '&#x5F97;&#x5206;&#xFF1A;<input type=text class=short name="jd-'.$an_id[0].'-'.$x.'" value="0" onkeyup="value=value.replace(/[^\d]/g,\'\')"';
  90. echo '</td></tr>';
  91. $arr_aid[] = $an_id[0];
  92. }
  93. echo '</table><br />';
  94. }
  95. echo '<input type=hidden name=pid value="'.$pid.'" />';
  96. $_SESSION['aid'] = array_unique($arr_aid);
  97. mysql_close($con);
  98. ?>
  99. <div class="space30"></div>
  100. <input type="submit" value="&#x4FDD;&#x5B58;" />
  101. <div class="space30"></div>
  102. </form>
  103. </body>
  104. </html>