-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogs.php
54 lines (50 loc) · 1.19 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
function top($file = null) {
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
<title>Logai</title>
<style type=\"text/css\">
body {
font-family: Monospace;
font-size: 12px;
color: #000000;
background-color: #FFFFFF;
text-align: ".($file ? "left" : "center").";
}
a {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: underline;
color: #000000;
}
</style>
</head>
<body>\n";
}
function bottom() {
echo "\n</body>
</html>";
}
$file = "logs/".$_GET["y"]."-".$_GET["m"]."-".$_GET["d"].".txt";
if (is_readable($file)) {
top(true);
echo str_replace("\r", "<br>", htmlspecialchars(trim(file_get_contents($file))));
}
else {
top();
$files = glob("logs/*-*-*.txt");
foreach ($files as $id => $file) {
if ($id > 0) {
echo "<br>\n";
}
$date = str_replace(array("logs/", ".txt"), "", $file);
$date2 = explode("-", $date);
echo "<a href=\"?y=".$date2[0]."&m=".$date2[1]."&d=".$date2[2]."\">".$date."</a>";
}
}
bottom();
?>