1 |
<?php |
2 |
|
3 |
// A test navigation thingy. |
4 |
// pjm2@ukc.ac.uk |
5 |
|
6 |
|
7 |
function getdirArray($dir='./',$sort='asort') { |
8 |
global $dir_file_count; |
9 |
if ( is_dir($dir) ) { |
10 |
$fd = @opendir($dir); |
11 |
while ( ($part = @readdir($fd)) == TRUE ) { |
12 |
clearstatcache(); |
13 |
if ($part != "." && $part != "..") { |
14 |
$dir_array[] = $part; |
15 |
} |
16 |
} |
17 |
if($fd == TRUE) { |
18 |
closedir($fd); |
19 |
} |
20 |
if (is_array($dir_array)) { |
21 |
$sort($dir_array); |
22 |
$dir_file_count = count($dir_array); |
23 |
Return $dir_array; |
24 |
} else { |
25 |
Return FALSE; |
26 |
} |
27 |
} else { |
28 |
Return FALSE; |
29 |
} |
30 |
} |
31 |
|
32 |
include("day.inc"); |
33 |
|
34 |
?> |
35 |
|
36 |
<html> |
37 |
<body bgcolor="#ffffff"> |
38 |
|
39 |
<table border="0" align="center" cellpadding="2" cellspacing="5"> |
40 |
<tr> |
41 |
<td> |
42 |
<? include("left.inc"); ?> |
43 |
</td> |
44 |
<td> |
45 |
<? include("title.inc"); ?> |
46 |
|
47 |
|
48 |
<font face="arial, sans-serif" size="2"> |
49 |
<b>View reports for <? echo "$day" ?></b> |
50 |
</font> |
51 |
|
52 |
<p> |
53 |
|
54 |
<form method="GET" action=""> |
55 |
<select size="1" name="machine_name"> |
56 |
<? include("machine_name.inc"); ?> |
57 |
</select> |
58 |
|
59 |
<select size="1" name="report"> |
60 |
<? include("report.inc"); ?> |
61 |
</select> |
62 |
|
63 |
<input type="submit" name="submit" value="bung"> |
64 |
</form> |
65 |
|
66 |
</p> |
67 |
|
68 |
|
69 |
<? |
70 |
if ($submit == "bung") { |
71 |
$url = escapeshellcmd("$day/$machine_name/$report/chart.gif"); |
72 |
if (file_exists($url)) { |
73 |
echo "<p><b>$machine_name - $report</b><br><img src=\"$url\" width=\"500\" height=\"250\"><br><img src=\"24hour.gif\" width=\"500\" height=\"39\"></p>"; |
74 |
} |
75 |
else { |
76 |
echo "<p>The report could not be found.</p>"; |
77 |
} |
78 |
} |
79 |
|
80 |
?> |
81 |
|
82 |
<hr> |
83 |
|
84 |
<p> |
85 |
<font face="arial, sans-serif" size="2"> |
86 |
<b>Or browse all dates</b> |
87 |
</font> |
88 |
</p> |
89 |
|
90 |
<? |
91 |
|
92 |
$file_array = getdirArray('/home/cut/pjm2/webpages/reports','asort'); |
93 |
foreach($file_array as $file_name) { |
94 |
if (is_dir($file_name)) { |
95 |
print "+ <a href=\"$file_name\">$file_name</a><br>"; |
96 |
} |
97 |
} |
98 |
|
99 |
?> |
100 |
|
101 |
<? include("bottom.inc"); ?> |
102 |
|
103 |
</body> |
104 |
</html> |