forked from huunam0/web4themis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.php
More file actions
31 lines (30 loc) · 930 Bytes
/
timer.php
File metadata and controls
31 lines (30 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
include("config.php");
include($contestDir . "info.php");
//date_default_timezone_set("Asia/Bangkok");
$t = $begintime + $duringTime*60 - time();
$tgchonop=60;
echo "<script>var conlai = $t;</script>";
//print_r ($begintime);
if ($t > $duringTime*60) {
$t -= $duringTime*60;
$h = ($t - $t%3600)/3600;
$t = $t%3600;
$m = ($t - $t%60)/60;
$s = $t%60;
echo "- Sẽ bắt đầu sau: ".$h .":".sprintf("%02d", $m).":".sprintf("%02d", $s);
} else if ($t > 0) {
$h = ($t - $t%3600)/3600;
$t = $t%3600;
$m = ($t - $t%60)/60;
$s = $t%60;
echo "- Thời gian còn lại: ".$h .":".sprintf("%02d", $m).":".sprintf("%02d", $s);
} else if ($t > -$tgchonop) {
$t = $tgchonop + $t;
$m = ($t - $t%60)/60;
$s = $t%60;
echo "- Thời gian còn lại: 0:00:00 + Nộp bài: 0:".$m.":".sprintf("%02d", $s);
} else {
echo "Đã hết thời gian làm bài.";
}
?>