-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogs.php
56 lines (38 loc) · 992 Bytes
/
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
55
56
<?php require_once("includes/initialize.php"); ?>
<?php
if(!$session->is_logged_in()) {
redirect_to("index.php");
}
$file = "logs/log.txt";
$message = "";
if(isset($_GET['delete']) && $_GET['delete'] == "true") {
if(file_exists($file)) {
unlink($file);
$message = "Log file has been deleted.";
redirect_to("logs.php");
}
}
?>
<?php require_once("includes/header.php"); ?>
<div class="cAlign">
<div id="fullWidthSection">
<h2 align="center">Logs</h2>
<div align="center">
<p> <?php if($message != "") { echo $message . "<br><br>"; } ?>
<?php
if(file_exists($file) && is_readable($file)) {
$content = file_get_contents($file);
echo nl2br($content);
} else {
echo "Log file does not exist.";
}
?>
</p>
<br>
<h4><a href="logs.php?delete=true">Delete Logs</a></h4>
</div>
<h4><a href="index.php">Back</a></h4>
</div>
<div class="cBoth"></div>
</div>
<?php require_once("includes/footer.php"); ?>