forked from huunam0/web4themis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logs.php
39 lines (38 loc) · 1.23 KB
/
logs.php
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
32
33
34
35
36
37
38
39
<?php
include("init.php");
include("config.php");
include($contestDir . "info.php");
$session = $user['username'];
//Cac file chua cham
$dir = opendir($uploadDir);
while ($file = readdir($dir)) {
$pos = strpos($file,"[".$session."]");
if ($pos > 0) {
echo "<p>";
if ($publish == 1) echo "» <a href='download.php?file=".$file."'>".substr($file,$pos+strlen($session)+2)."</a>";
else echo "» <a href='#'>".substr($file,$pos+strlen($session)+2)."</a>";
echo "</p>";
}
}
//Cac file da cham xong
$dir = opendir($logsDir);
while ($file = readdir($dir)) {
$pos = strpos($file,"[".$session."]");
if ($pos > 0) {
echo "<p>";
if ($publish == 1) echo "» <a href='download.php?file=".$file."'>".substr($file,$pos+strlen($session)+2)."</a> (";
else echo "» <a href='#'>".substr($file,$pos+strlen($session)+2)."</a> (";
if (strpos($file,".log") > 0 || strpos($file,".LOG") > 0) {
if ($publish == 1) {
$finp = fopen($logsDir."/".$file,"r");
$str = substr(fgets($finp),strlen($session)+3);
fclose($finp);
}
else $str = "Đã chấm xong!";
}
else $str = "Đang đợi chấm...";
echo $str.")";
echo "</p>";
}
}
?>