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