-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror_log.php
125 lines (112 loc) · 2.34 KB
/
error_log.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
/**
* The purpose was to create a single page that could fetch and display the error log
* @author Kiran Ruth
* License : Non applicable
*/
// check if error log is enabled
$isLog = ini_get('log_errors');
if($isLog != 1){
exit;
}
$logFile = ini_get('error_log');
// if trun then truncate the errorLog
if($_REQUEST['req'] == "trun"){
$myFile = $logFile;
$fh = fopen($myFile, 'w');
fclose($fh);
header('Location: error_log.php');
}
// refresh errorLog
if($_REQUEST['req'] == "refresh"){
header('Location: error_log.php');
}
?>
<html>
<title>
Php Error Log Viewer
</title>
<link rel="icon"
type="image/png"
href="http://www.sql-tutorial.ru/view/gimages/console.png"></link>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<style>
Body{
margin-left:10px;
margin-right:10px;
display:block;
margin-top:10px;
margin-bottom:10px;
background-color:#efefef;
border-style: solid;
border-width: 2px;
padding: 5px;
max-height
}
a{
padding: 4px;
border-radius: 5px;
text-decoration: initial;
margin-top:10px;
margin-right:6px;
}
a:hover{
padding-top: 4px;
border-radius: 5px;
text-decoration: initial;
margin-right:6px;
}
.truncate{
background-color: #FC2A2A;
color: white;
}
.truncate:hover{
background-color: #f47a7a;
color: white;
}
.refresh{
background-color: #7fff00;
color: black;
}
.refresh:hover{
background-color: #d4ffaa;
color: black;
}
.bar{
padding: 10px;
background-color: #666;
position: fixed;
top: 0px;
left: 0px;
width: 100%;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('#scroll_up').click(function(){
$('html, body').animate({ scrollTop: 0 });
});
$('#scroll_down').click(function(){
var target = $('#end').offset().top;
console.log(target);
$('html, body').animate({ scrollTop: target });
});
});
</script>
<body>
<div class="bar">
<a class="truncate" href="error_log.php?req=trun">Truncate</a>
<a class="refresh" href="error_log.php?req=refresh">Refresh</a>
<a class="refresh" id="scroll_down" href="#">Scroll Down</a>
<a class="refresh" id="scroll_up" href="#">Scroll Up</a>
</div>
<BR/>
<BR/>
<?php
$errorLog = file_get_contents($logFile);
// echo error log :p .... yeah yeah i know no rocket science just thought i'll comment
echo nl2br($errorLog);
?>
<div id="end"></div>
</body>
</html>