-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathview.php
More file actions
57 lines (48 loc) · 970 Bytes
/
view.php
File metadata and controls
57 lines (48 loc) · 970 Bytes
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('inc/lib.inc');
$html_top = '
<HTML><HEAD>
<TITLE>File viewer</TITLE>
<LINK rel="stylesheet" href="style.css" type="text/css">
</HEAD><BODY bgcolor="ccdd88" >
';
$html_bottom = '
</BODY>
</HTML>
';
#
# MAIN
#
get_input();
if (!empty($INPUT_VARS['error']))
$color='RED';
else
$color = 'BLACK';
print $html_top;
$file = false;
if (isset($INPUT_VARS['file'])) $file = $INPUT_VARS['file'];
if (!empty($INPUT_VARS['base']) && $INPUT_VARS['base'] == "LOGS") {
$base = $LOG_DIR;
$tbase = "Log file";
}
else {
$base = $HOST_DIR;
$tbase = "File";
}
if ($file) {
if (preg_match('/\.\./', $file)) {
print "<H3>Incorrect file name $file</H3>\n";
}
print "<H3>$tbase: $file</H3>\n";
print "<HR><PRE>\n";
print "<FONT COLOR=$color>\n";
if (file_exists("$base/$file")) {
print join("",file("$base/$file"));
} else {
print "That file does not exist.";
}
print "</FONT>\n";
print "</PRE>\n";
};
print $html_bottom;
?>