-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.php
More file actions
22 lines (22 loc) · 722 Bytes
/
timer.php
File metadata and controls
22 lines (22 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<script type="text/javascript">
setInterval(function(){
var gid = '<?=$exgid?>';
var sid = '<?=$userid?>';
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function (){
if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
var result = document.getElementById('val');
var rt = xmlhttp.responseText;
var res = rt.split(":");
var min = res[0];
var sec = res[1];
result.innerHTML = rt;
if(sec==0 && min==0){
window.location='finishexam.php?exgid='+gid+'&sid='+sid;
}
}
}
xmlhttp.open('GET','countdown.php?gid='+gid+'&stid='+sid,true);
xmlhttp.send(null);
},1000);
</script>