Initial commit

This commit is contained in:
Brus 2026-01-11 17:25:10 +01:00
commit c3f8908cb5
8 changed files with 660 additions and 0 deletions

54
index.php Normal file
View file

@ -0,0 +1,54 @@
<?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</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</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>