54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
$db = new PDO("sqlite:/var/www/data/ssl.db");
|
|
$rows = $db->query("SELECT * FROM certs ORDER BY expires ASC")->fetchAll(PDO::FETCH_ASSOC);
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>SSL Monitor GeoSphere Austria v.01</title>
|
|
<style>
|
|
body { font-family: Arial; background:#f4f4f4 }
|
|
table { border-collapse:collapse; width:80%; margin:auto; background:#fff }
|
|
th,td { padding:10px; border:1px solid #ddd; text-align:center }
|
|
th { background:#222; color:#fff }
|
|
.ok { color:green; font-weight:bold }
|
|
.warn { color:orange; font-weight:bold }
|
|
.critical { color:red; font-weight:bold }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<h2 style="text-align:center">SSL Certificate Monitor Geosphere Austria</h2>
|
|
|
|
<table>
|
|
<tr>
|
|
<th>Domain</th>
|
|
<th>Expires</th>
|
|
<th>Days Left</th>
|
|
<th>Status</th>
|
|
<th>Last Check</th>
|
|
</tr>
|
|
|
|
<?php foreach ($rows as $r):
|
|
if (!$r["expires"]) {
|
|
echo "<tr><td>{$r['domain']}</td><td colspan=4 class='critical'>{$r['error']}</td></tr>";
|
|
continue;
|
|
}
|
|
|
|
$days = floor(($r["expires"] - time()) / 86400);
|
|
if ($days > 30) $c="ok";
|
|
elseif ($days > 7) $c="warn";
|
|
else $c="critical";
|
|
?>
|
|
<tr>
|
|
<td><?= htmlspecialchars($r["domain"]) ?></td>
|
|
<td><?= date("Y-m-d H:i:s", $r["expires"]) ?></td>
|
|
<td><?= $days ?></td>
|
|
<td class="<?= $c ?>"><?= strtoupper($c) ?></td>
|
|
<td><?= date("Y-m-d H:i:s", $r["checked_at"]) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
|
|
</table>
|
|
</body>
|
|
</html>
|