1 |
pjm2 |
1.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 |
|
|
if ($submit == "bung") { |
35 |
|
|
$url = escapeshellcmd("$day/$machine_name/$report/chart.gif"); |
36 |
|
|
Header("Location: $url"); |
37 |
|
|
exit; |
38 |
|
|
} |
39 |
|
|
?> |
40 |
|
|
|
41 |
|
|
<html> |
42 |
|
|
<body bgcolor="eeeeff"> |
43 |
|
|
|
44 |
|
|
<font face="arial, sans-serif"> |
45 |
|
|
<h4>I-scream report browser</h4> |
46 |
|
|
</font> |
47 |
|
|
|
48 |
|
|
<hr> |
49 |
|
|
|
50 |
|
|
<font face="arial, sans-serif" size="2"> |
51 |
|
|
<b>View reports for <? echo "$day" ?></b> |
52 |
|
|
</font> |
53 |
|
|
|
54 |
|
|
<p> |
55 |
|
|
|
56 |
|
|
<form method="GET" action="browser.php"> |
57 |
|
|
<select size="1" name="machine_name"> |
58 |
|
|
<? include("machine_name.inc"); ?> |
59 |
|
|
</select> |
60 |
|
|
|
61 |
|
|
<select size="1" name="report"> |
62 |
|
|
<? include("report.inc"); ?> |
63 |
|
|
</select> |
64 |
|
|
|
65 |
|
|
<input type="submit" name="submit" value="bung"> |
66 |
|
|
|
67 |
|
|
</form> |
68 |
|
|
|
69 |
|
|
</p> |
70 |
|
|
|
71 |
|
|
<hr> |
72 |
|
|
|
73 |
|
|
<p> |
74 |
|
|
<font face="arial, sans-serif" size="2"> |
75 |
|
|
<b>Or browse all dates</b> |
76 |
|
|
</font> |
77 |
|
|
</p> |
78 |
|
|
|
79 |
|
|
<? |
80 |
|
|
|
81 |
|
|
$file_array = getdirArray('/home/cut/pjm2/webpages/reports','asort'); |
82 |
|
|
foreach($file_array as $file_name) { |
83 |
|
|
if (is_dir($file_name)) { |
84 |
|
|
print "+ <a href=\"$file_name\">$file_name</a><br>"; |
85 |
|
|
} |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
?> |
89 |
|
|
|
90 |
|
|
</body> |
91 |
|
|
</html> |