tt
This commit is contained in:
137
anser.php
Normal file
137
anser.php
Normal file
@@ -0,0 +1,137 @@
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="msapplication-tap-highlight" content="no" />
|
||||
<!--Let browser know website is optimized for mobile-->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>礼敬中华 知识答题</title>
|
||||
<meta name="description" content="北京邮电大学学生会网络部网页答题" />
|
||||
<meta name="author" content="flyto.cc/lenny" />
|
||||
<!-- Favicons-->
|
||||
<link rel="icon" href="p/bupt_logo.png" />
|
||||
<!-- Import Google Icon Font -->
|
||||
<link href="css/icon.css" rel="stylesheet" />
|
||||
<!-- CSS-->
|
||||
<!-- Compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="css/materialize.css" />
|
||||
<!-- Import Jq CSS -->
|
||||
<script src="js/jquery-2.1.4.min.js"></script>
|
||||
<!-- IMPORT EXTRA JS/CSS -->
|
||||
<!-- ####################################################### -->
|
||||
<script src="js/form.js"></script>
|
||||
<link rel="stylesheet" href="css/biankuang.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/header.css">
|
||||
<style type="text/css">
|
||||
label {
|
||||
width:100%
|
||||
}
|
||||
</style>
|
||||
<!-- ####################################################### -->
|
||||
<!-- END IMPORT EXTRA JS/CSS -->
|
||||
</head>
|
||||
<body>
|
||||
<div style="box-sizing:content-box;font-family:Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Noto Sans CJK SC,WenQuanYi Micro Hei,Arial,sans-serif;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default;" onclick="$('body,html').animate({scrollTop:0},500);">
|
||||
<header class="Sticky AppHeader is-fixed" style="width:100%;top:0px;left:0px;">
|
||||
<div class="AppHeader-inner" style="box-sizing:content-box;padding:0;width:100%;">
|
||||
<nav role="navigation" style="height:60px;line-height:60px;">
|
||||
<div class="nav-wrapper container">
|
||||
<a id="logo-container" href="#" class="brand-logo" style="font-size:1.6rem;">
|
||||
<img src="p/bupt_logo.png" alt="bupt" height="30px" style="vertical-align:middle;margin:0 10px 0 0;">礼敬中华 知识答题
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="PageHeader">
|
||||
<nav role="navigation" style="height:60px;">
|
||||
<div class="nav-wrapper container">
|
||||
<div style="text-align:center;display:inline-block;padding:5px 0;width:100%;float:left;">本次答题限时15分钟 剩余时间 <span name="remtime">15:00</span></div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
<div class="progress" style="margin:0;position:fixed;top:60px;height:3px;z-index:999">
|
||||
<div class="determinate" style="width:0%"></div>
|
||||
</div>
|
||||
<div class="Sticky--holder" style="position:relative;top:0px;right:0px;bottom:0px;left:0px;display:block;float:none;margin:0px;height:60.8px;visibility:hidden;font-size:15px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php
|
||||
//link to mysql
|
||||
$con=mysqli_connect("localhost","buptStudent","buptStudentlx","buptStudentdb");
|
||||
if (!$con){die('Could not connect:' . mysql_error());};
|
||||
//mysql_select_db("my_db_test", $con);
|
||||
$p = 20;
|
||||
$pp = 0;
|
||||
$ppp = $p + $pp;//the number of questions
|
||||
// echo "<div id=\"ppp\" ppp=\"".$ppp."\"></div>\n<div class=\"section\" id=\"hiddenBefore\" style=\"display:none\"><h5> 单选题</h5>\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 "<div class=\"spbq\" name=\"div_e\"><div class=\"biankuang biankuang_1\"></div><div class=\"biankuang biankuang_2\"></div><div class=\"biankuang biankuang_3\"></div><div class=\"biankuang biankuang_4\"></div><h6 id=\"question_".$i."\">". $i. ".". $row['q'] ."</h6>";
|
||||
echo "<p><p>正确答案是: $result[$list[$result[answer]]] </p><p>你的答案是: $result[$list[$a]]</p></p>"
|
||||
//echo "<p><input class=\"with-gap\" type=\"radio\" name=\"answer_". $i. "\" value=\"1\" id=\"test". $i. "1\" onclick=\"addOne(this)\"/>\n<label for=\"test". $i. "1\">". $row['A'] ."</label>\n<input class=\"with-gap\" type=\"radio\" name=\"answer_". $i. "\" value=\"2\" id=\"test". $i. "2\" onclick=\"addOne(this)\"/>\n<label for=\"test". $i. "2\">". $row['B'] ."</label>\n<input class=\"with-gap\" type=\"radio\" name=\"answer_". $i. "\" value=\"3\" id=\"test". $i. "3\" onclick=\"addOne(this)\"/>\n<label for=\"test". $i. "3\">". $row['C'] ."</label>\n<input class=\"with-gap\" type=\"radio\" name=\"answer_". $i. "\" value=\"4\" id=\"test". $i. "4\" onclick=\"addOne(this)\"/>\n<label for=\"test". $i. "4\">". $row['D'] ."</label>\n</p></div>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// echo "<!-- </div><div class=\"section\"> --><h5> 二、判断题</h5>";
|
||||
// $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 "<p>".$row."</p>";
|
||||
// echo "<div class=\"spbq\" name=\"div_e\"><div class=\"biankuang biankuang_1\"></div><div class=\"biankuang biankuang_2\"></div><div class=\"biankuang biankuang_3\"></div><div class=\"biankuang biankuang_4\"></div><h6 id=\"question_".$j."\">". $j. ".". $row['q'] ."</h6>\n<p><input class=\"with-gap\" type=\"radio\" name=\"answer_". $j. "\" value=\"1\" id=\"test". $j. "1\" onclick=\"addOne(this)\"/>\n<label for=\"test". $j. "1\">正确</label>\n<input class=\"with-gap\" type=\"radio\" name=\"answer_". $j. "\" value=\"2\" id=\"test". $j. "2\" onclick=\"addOne(this)\"/>\n<label for=\"test". $j. "2\">错误</label>\n</p></div>\n";
|
||||
// echo "<div class=\"input-field col s12\" style=\"height:1px;overflow:hidden\"><input value=\"".$random."\" type=\"text\" class=\"validate\" style=\"color:#fff\" name=\"question_".$j."\"></div>\n";
|
||||
// }
|
||||
// }
|
||||
|
||||
echo "</div>";
|
||||
//close linking
|
||||
mysqli_close($con);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<footer class="page-footer" style="padding-top:0;margin-top:30px;display: none;" id="theFooter">
|
||||
<div class="footer-copyright" style="text-align:center;">
|
||||
<div class="container">©2018 Bupt-Web.
|
||||
<a class="grey-text text-lighten-4" href="mailto:lenny.n@outlook.com">Mail Us</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<!-- Scripts-->
|
||||
<script src="js/materialize.js"></script>
|
||||
<!-- Init JS -->
|
||||
<script src="js/init.js"></script>
|
||||
<!-- IMPORT EXTRA JS/CSS -->
|
||||
<!-- ####################################################### -->
|
||||
<script src="js/questionnaire.js"></script>
|
||||
<!-- ####################################################### -->
|
||||
<!-- END IMPORT EXTRA JS/CSS -->
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user