<?php $config = readconfig(); header1(); foreach ($config as $code => $data) { area($code, $data["x"], $data["y"], $data["dx"], $data["dy"]); } header2(); foreach ($config as $code => $data) { showlink($code, $data["name"], $data["location"], $data["url"]); } header3(); function header1() { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>New South Wales Trails Map</title> <style type="text/css"> body { padding: 0; margin: 0; } #map ul { padding: 0; margin: 0; } #map { margin:0;
function readconfig($file) { $handle = @fopen($file, "r") or die("{$file}: non-existent"); $line = fgets($handle, 4096); while (!feof($handle)) { $index = strlen($line) - 1; $line = trim($line); if ($line[0] != '#' && strlen($line) != 0) { $hosts[] = $line; } $line = fgets($handle, 4096); } fclose($handle); return $hosts; } $hosts = readconfig($NCTOPCONF); /* print table */ echo "<table border=\"0\" width=\"100%\">\n"; /* toggle columns - rows */ $newline = 0; foreach ($hosts as $host) { if (!$newline) { echo "<tr>\n"; } echo "<td width=\"50%\" align=center>\n"; echo "<img src=\"" . $CGIBIN . "plotstat.pl?HOST={$host}\" alt=\"{$host}\">\n"; echo "</td>\n"; if ($newline) { echo "</tr>\n"; } $newline = !$newline;