| Server IP : 104.21.80.248 / Your IP : 172.71.28.156 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/news/elearning/ |
Upload File : |
<?php
require './configs/app_top.php';
//$title = "ทำแบบทดสอบ";
#unset($_SESSION["q_attempt"]);
#echo '<pre>';
#print_r($_SESSION);
#echo '</pre>';
include './includes/header.php';
include './configs/host.php';
?>
<div class="container mainbody">
<div class="col-12">
<div class="clearfix"></div>
<div class="clearfix"></div>
</div>
<div class="padding5 clearfix"></div>
<style>
.col-offset-4{margin-left: 36% !important;}
</style>
<script src="<?php echo get_admin_url(); ?>js/countdown.js"></script>
<script>
var st = '<?php echo intval($_SESSION["last_exam_time"]); ?>';
function last_exam_time() {
$.ajax({
type: "GET",
url: "<?php echo generate_site_link("ajax/inc_last_exam_time"); ?>",
data: "lext=" + window.st,
cache: false,
success: function(html) {
//console.log("New Value : "+html)
window.st = html;
}
});
}
function time_over() {
document.getElementById("form1").submit();
}
function submitExams() {
if (confirm('คุณพร้อมที่จะส่งแบบทดสอบหรือไม่')) {
document.getElementById("form1").submit();
}
}
</script>
<div class="col-6 col-offset-4" style="overflow: hidden;height: 70px;" id="foo">
</div>
<div class="clearfix"></div>
<div class="padding10"></div>
<?php if ($ERROR_TYPE <> "") { ?>
<div class="col-6 center">
<div class="alert alert-<?php echo $ERROR_TYPE; ?>">
<button data-dismiss="alert" class="close" type="button">×</button>
<?php echo $ERROR_MSG; ?>
</div>
</div>
<?php } ?>
<div class="clearfix"></div>
<div class="row">
<div class="col-12">
<div class="well well-lg">
<div id="loginForm">
<?php
//ตรวจสอบว่าผ่านการสอบมากี่ครั้ง
$uid=$_SESSION["user_id"];
$subject_id=$_SESSION["exam_id"];
$chk_test="select * from exp_test_results WHERE tr_user_id='$uid' and tr_subject_id='$subject_id' ";
$result1=mysql_query($chk_test);
$total=mysql_num_rows($result1);
$record = mysql_fetch_array($result1);
?>
<?php
$chk_num="select * from exp_subjects WHERE sb_id='$subject_id' ";
$result2=mysql_query($chk_num);
$record2 = mysql_fetch_array($result2);
$sb_count=$record2['sb_count'];
if ($total >= $sb_count) {
echo "<center><font color='red'>แบบทดสอบชุดนี้สอบได้ไม่เกิน $sb_count ครั้ง</font><br>*นักเรียนได้ทำแบบทดสอบครบแล้วครับ</center>";
} else {
?>
<form class="form-horizontal" method="post" id="form1" name="form1" action="<?php echo generate_site_link("exams_auth"); ?>">
<input type="hidden" value="end" name="mode">
<input type="hidden" value="<?php echo intval($_SESSION["user_id"]); ?>" name="eid">
<input type="hidden" value="<?php echo ($_SESSION["exam_start_time"]); ?>" name="st_exams_time">
<fieldset>
<div class="form-group">
<div class="margin10"></div>
<div id="main_zone"></div>
<div class="padding10"></div>
<center> <button style="width:320px;" class="btn btn-warning loginbutton" type="button" onclick="submitExams();">ส่งแบบทดสอบ</button></center>
<div class="help-block center" style="color: #000;">เมื่อหมดเวลาสอบระบบจะส่งและตรวจโดยอัตโนมัติ.</div>
</div>
</fieldset>
</form>
<?php
}
?>
</div>
</div>
</div>
</div>
<script>
function loadQuestions(qn) {
$.ajax({
type: "GET",
url: "<?php echo generate_site_link("ajax/question"); ?>",
data: "qno=" + qn,
cache: false,
beforeSend: function() {
//$('#state1').html("").hide();
$("#qtns").hide("fast");
},
success: function(html) {
//$('#state1').html(html).show();
//alert(html);
$("#main_zone").html(html);
$("#qtns").show("fast");
}
});
}
$(window).load(function() {
// Run code
loadQuestions(0);
});
setInterval(last_exam_time, 1000);
</script>
<script type="application/javascript">
var myCountdown4 = new Countdown({
time: '<?php echo intval((intval($_SESSION["etime"]) * 60) - $_SESSION["last_exam_time"]); ?>',
width:300,
rangeHi : "hour",
hideLine : true,
height:60,
target : "foo",
padding : 1.0,
onComplete : time_over,
numbers : {
font : "Trebuchet MS",
color : "#FFFFFF",
bkgd : "#990000",
fontSize : 200,
shadow : {
x : 0,
y : 3,
s : 4,
c : "#000000",
a : 0.4
}
},
labels : {
textScale : 0.8,
offset : 5
}
});
</script>
<?php
include './includes/footer.php';
require './configs/app_bottom.php';
?>