-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.php
More file actions
63 lines (56 loc) · 2.33 KB
/
log.php
File metadata and controls
63 lines (56 loc) · 2.33 KB
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
<?php
require_once('classes/autoloader.php');
require_once('include/loggingsetup.php');
require_once('include/validatesession.inc');
require_once('include/commonFunctions.php.inc');
include_once('config/db.php.inc');
if (isAdmin()) {
$file = "log/sessionweb.log";
if (file_exists($file)) {
$lines = file($file);
foreach ($lines as $line_num => $line) {
$re1 = '.*?'; # Non-greedy match on filler
$re2 = '';//'(\\] )'; # Any Single Character 1
$re3 = '( )'; # White Space 1
$re4 = '(DEBUG)'; # Word 1
$re4b = '(ERROR)';
$re4c = '(INFO)';
$re4d = '(WARN)';
$re4e = '(SQL)';
$re4f = '(FATAL)';
if ($c = preg_match_all("/" . $re1 . $re2 . $re3 . $re4 . "/is", $line, $matches)) {
echo '<FONT style="BACKGROUND-COLOR: #00d5ff">';
echo "$line";
echo '</FONT><br>';
} elseif ($c = preg_match_all("/" . $re1 . $re2 . $re3 . $re4e . "/is", $line, $matches)) {
echo '<FONT style="BACKGROUND-COLOR: #CCFF00">';
echo "$line";
echo '</FONT><br>';
} elseif ($c = preg_match_all("/" . $re1 . $re2 . $re3 . $re4b . "/is", $line, $matches)) {
echo '<FONT style="BACKGROUND-COLOR: #ff2364">';
echo "$line";
echo '</FONT><br>';
} elseif ($c = preg_match_all("/" . $re1 . $re2 . $re3 . $re4c . "/is", $line, $matches)) {
echo '<FONT style="BACKGROUND-COLOR: #00ff17">';
echo "$line";
echo '</FONT><br>';
} elseif ($c = preg_match_all("/" . $re1 . $re2 . $re3 . $re4d . "/is", $line, $matches)) {
echo '<FONT style="BACKGROUND-COLOR: yellow">';
echo "$line";
echo '</FONT><br>';
} elseif ($c = preg_match_all("/" . $re1 . $re2 . $re3 . $re4f . "/is", $line, $matches)) {
echo '<FONT style="BACKGROUND-COLOR: red">';
echo "$line";
echo '</FONT><br>';
} else {
echo "$line<br>";
}
}
} else {
echo "no log file exist, please check that log folder is Read/write to the web server user";
}
} else {
Echo "You are not an admin user!";
exit();
}
?>