-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
executable file
·74 lines (63 loc) · 2.04 KB
/
admin.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<html>
<body>
<center>
<br><br>
<form action="admin.php" method="get">
<input type="submit" value="+1!">
</form>
<br>
<?php
$file = fopen("log.txt", "r+") or exit("Unable to open file!");
//reikia i paskutine eilute kursoriu nunest
echo ftell($file) . "->";
fseek($file, -11, SEEK_END);
$data = fgetcsv($file);
echo ftell($file);
echo "<br>";
echo "Current day is " . date("d") . ". Time is ";
$hour = date("H") + 3; //TIMEZONE VILNIUS
echo $hour;
echo ": ";
echo date("i") . ". ";
$plusone = $data[3] + 1;
if ($plusone < 100 && $plusone != 1 && $plusone != 2 && $plusone != 3 && $plusone != 4 && $plusone != 5 && $plusone != 6 && $plusone != 7 && $plusone != 8 && $plusone != 9)
echo "Current Ticket No. 0" . $plusone;
elseif ($plusone < 10)
echo "Current Ticket No. 00" . $plusone;
else
echo "Current Ticket No. " . $plusone;
fwrite($file, "\r\n");
fwrite($file, date("d") . ",");
$hour = date("H") + 3; //TIMEZONE VILNIUS
fwrite($file, $hour);
fwrite($file, ",");
fwrite($file, date("i") . ",");
$plusone = $data[3] + 1;
if ($plusone < 100 && $plusone != 1 && $plusone != 2 && $plusone != 3 && $plusone != 4 && $plusone != 5 && $plusone != 6 && $plusone != 7 && $plusone != 8 && $plusone != 9)
fwrite($file, "0" . $plusone);
elseif ($plusone < 10)
fwrite($file, "00" . $plusone);
else
fwrite($file, $plusone);
fclose($file);
?>
<br><br>
<?php
$file = fopen("log.txt", "r") or exit("Unable to open file!");
while (!feof($file)) {
$data2 = fgetcsv($file);
echo "No. " . $data2[3] . " was signed at " . $data2[1] . ":" . $data2[2] . ".";
echo "<br>";
}
fclose($file);
?>
<br><br>
<form action="clear.php" method="get">
<input type="submit" value="CLEAR 0!">
</form>
<br>
<a href="log.txt" target="_blank">LOG.TXT</A>
</form>
</center>
</body>
</html>