diff --git a/anser.php b/anser.php new file mode 100644 index 0000000..a42d4c6 --- /dev/null +++ b/anser.php @@ -0,0 +1,137 @@ + + + + + + + + + + 礼敬中华 知识答题 + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+
+
+
+ +
+
+
+
\n
  单选题
\n"; + //创建随机数组 + shuffle($randomArray); + for($i = 1;$i <= $p;$i++){ + $random = $randomArray[$i]; + $chongfu="SELECT Student_ID FROM UserAnswer WHERE Student_ID=$_SESSION[Student_ID]"; + $result2 = mysqli_query($con,"SELECT * FROM UserAnswer WHERE Student_ID = '$_SESSION[Student_ID]'"; + if(!mysqli_fetch_array(mysqli_query($con,$chongfu))[0]==$_POST[student_id]){ + die('请先完成问卷'); + } + $list = { + 1=> 'A', + 2=> 'B', + 3=> 'C', + 4=> 'D' + } + $row = mysqli_fetch_array($result2) + for($i = 1;$i <= 20;$i++){ + $q = floor($row[ap_$i] / 10); + $a = floor($row[ap_$i] % 10); + $result = mysqli_query($con,"SELECT * FROM Persons WHERE num='$q'"); + echo "
". $i. ".". $row['q'] ."
"; + echo "

正确答案是: $result[$list[$result[answer]]]

你的答案是: $result[$list[$a]]

" + //echo "

\n\n\n\n\n\n\n\n

\n"; + } + } + + // echo "
  二、判断题
"; + // $randomArray = range(1,10); + // shuffle($randomArray); + // for($i = 1;$i <= $pp;$i++){ + // $random = $randomArray[$i] + 60; + // $result = mysqli_query($con,"SELECT q FROM Persons WHERE num='$random'"); + // while($row = mysqli_fetch_array($result)){ + // $j = $i + $p; + // //echo "

".$row."

"; + // echo "
". $j. ".". $row['q'] ."
\n

\n\n\n\n

\n"; + // echo "
\n"; + // } + // } + + echo "
"; + //close linking + mysqli_close($con); + ?> +
+ + + + + + + + + + + + + + + diff --git a/index.php b/index.php index 54d36c2..036a888 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,5 @@ + @@ -7,7 +8,7 @@ - 315权益知识答题 + 礼敬中华 知识答题 @@ -40,7 +41,7 @@ @@ -96,7 +97,7 @@
- " type="text" class="validate" style="color:#fff" name="timestart"> + " type="text" class="validate" style="color:#fff" name="timestart">
本次答题限时15分钟    剩余时间  15:00
diff --git a/test.php b/test.php index e990479..af86f6a 100644 --- a/test.php +++ b/test.php @@ -16,6 +16,7 @@ { die('对不起,您已参与过本活动。'); } + $_SESSION['Student_ID'] = $_POST[student_id]; $sql="INSERT INTO UserAnswer (user_name, Student_ID, school, userclass, phone, ip, timeend ,timestart, thetime) VALUES ('$_POST[user_name]','$_POST[student_id]','$_POST[school]','$_POST[userclass]','$_POST[telephone]','$userIp','$timeend','$_POST[timestart]','$sec')"; if (!mysqli_query($con,$sql)) { @@ -65,7 +66,7 @@ //echo "No.".$i." your choice is ".$c." answer is ".$e."
"; //}; //echo "每题一分: your score is ".$g."
"; - echo "提交成功。谢谢参与我们的活动,请继续关注我们公众号bupt_stu的后续推送。现在你可以直接关闭页面了。"; //close linking mysql_close($con); + die("提交成功。谢谢参与我们的活动,请继续关注我们公众号bupt_stu的后续推送。现在你可以直接关闭页面了。"); ?> \ No newline at end of file