funnies/funnies-frame.php

72 lines
1.6 KiB
PHP
Raw Permalink Normal View History

2025-10-25 15:10:38 -04:00
<?php
$db = new SQLite3(__DIR__ . '/mentalnet_funnies.db');
$res = $db->query('SELECT * FROM comics ORDER BY date_added DESC LIMIT 3'); // show latest 3 for compactness
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MentalNet Funnies Frame</title>
<style>
html, body {
margin: 0;
padding: 0;
background: #111;
color: #eee;
font-family: monospace;
overflow-x: hidden;
}
h1 {
display: none; /* hide header for iframe context */
}
.comic {
margin-bottom: 1rem;
padding: 0.25rem 0.5rem;
}
h2 {
font-size: 0.9rem;
margin: 0.4rem 0;
color: #0ff;
text-align: center;
word-wrap: break-word;
}
img {
width: 250px;
border-radius: 4px;
display: block;
margin: 0 auto;
box-shadow: 0 0 6px #000;
}
p {
font-size: 0.8rem;
margin: 0.25rem auto;
text-align: center;
color: #bbb;
width: 95%;
line-height: 1.3;
}
small {
color: #666;
font-size: 0.7rem;
}
@media (max-width: 360px) {
img { width: 98%; }
h2 { font-size: 0.85rem; }
}
</style>
</head>
<body>
<?php while($row=$res->fetchArray()): ?>
<div class="comic">
<h2><?= htmlspecialchars($row['title']) ?></h2>
<img src="uploads/<?= htmlspecialchars($row['filename']) ?>" alt="<?= htmlspecialchars($row['title']) ?>">
<?php if($row['description']): ?>
<p><?= nl2br(htmlspecialchars($row['description'])) ?></p>
<?php endif; ?>
<p><small><?= htmlspecialchars(date('M j, Y', strtotime($row['date_added']))) ?></small></p>
</div>
<?php endwhile; ?>
</body>
</html>