<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Welcome to the WVMN Tile Server</title>
    <style>
        body {
            padding-left: 60px;
            padding-right: 60px;
        }
        table {
            font-family: Arial, sans-serif;
            border-collapse: collapse;
            width: 100%;
        }
        th, td {
            border: 1px solid #dddddd;
            text-align: left;
            padding: 8px;
        }
        th {
            background-color: #009879;
            color: #ffffff;
        }
        tr:nth-child(even) {
            background-color: #f2f2f2;
        }
    </style>
</head>
<body>

<h1>Welcome to the WVMN Tile Server</h1>
<h2>This tile server has the following tile sets:</h2>

<table>
  <tr>
    <th>Map System</th>
    <th>URL</th>
  </tr>
  <tr>
    <td>OpenStreetMap (OSM)</td>
    <td><b>//10.131.18.18/osm/tiles/{z}/{x}/{y}</b></td>
  </tr>
  <tr>
    <td>Satellite</td>
    <td><b>//10.131.18.18/satellite/tiles/{z}/{x}/{y}</b></td>
  </tr>
  <tr>
    <td>Weather Radar (Nexrad) (WMS Layer Format)</td>
    <td><b>//10.131.18.18/nexrad/</b></td>
  </tr>
</table>

<br />

<h2>Cache Status:</h2>

<table>
  <tr>
    <th>Map System</th>
    <th>Objects</th>
    <th>Cache Size</th>
  </tr>

<?php
function countFiles($dir) {
    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
    $count = 0;
    foreach ($iterator as $file) {
        if ($file->isFile()) {
            $count++;
        }
    }
    return $count;
}

$cache = explode("\n", shell_exec("du -hs /tmp/maps*"));
array_pop($cache);

foreach ($cache as &$value) {
    $data =  explode("      ", $value);
    echo "<tr><td>".str_replace("/tmp/maps-", "", $data[1])."</td><td>".countFiles($data[1])."</td><td>".$data[0]."</td></tr>";
}
?>
</table>

<br /><br />

<h2>For questions about this system contact:</h2>
<b>N:</b> Richard Cornwell<br />
<b>C:</b> K9RCP <br />
<b>E:</b> k9rcp@techtoknow.net<br />
<b>P:</b> 4048551727<br />

</body>
</html>