From 1d3feeb2fecb63a89c020df1c769c4afde92bed8 Mon Sep 17 00:00:00 2001 From: danny Date: Mon, 15 Jun 2026 06:35:43 +0200 Subject: [PATCH] Fake-Werbung (Admin-Joke): Skyscraper-Banner - API: fake_ads (public), fake_ads_all/create/toggle/delete (admin-only via requireAdminApi) - admin.php: Karte zum Anlegen/Aktivieren/Loeschen von Fake-Anzeigen - play.html: linke/rechte Skyscraper-Platzhalter, pollen aktive Ads und rotieren (nur Desktop) - Reiner Joke, keine echten Werbenetzwerke Co-Authored-By: Claude Opus 4.8 --- admin.php | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- api.php | 48 ++++++++++++++++++++++++++++++++++++++++ play.html | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+), 1 deletion(-) diff --git a/admin.php b/admin.php index 278b470..d5b6b1d 100644 --- a/admin.php +++ b/admin.php @@ -174,6 +174,23 @@

Lade…

+ + +
+
+

Fake-Werbung πŸ‘

+ +
+

+ Reiner Joke-Banner (Skyscraper) am Spielrand. Z. B. β€žPremium-Wolle fΓΌr 9,99€". +

+ + + + + +

Lade…

+
diff --git a/api.php b/api.php index 3364d74..7288de5 100644 --- a/api.php +++ b/api.php @@ -356,6 +356,14 @@ function performResolveRound(PDO $pdo, string $code, int $now): array return loadRoom($pdo, $code); } +function requireAdminApi(PDO $pdo, $authUserId): void +{ + if (!$authUserId) respond(['error' => 'Bitte erst einloggen.'], 401); + $st = $pdo->prepare('SELECT role FROM gtl_users WHERE id = ?'); + $st->execute([$authUserId]); + if ($st->fetchColumn() !== 'admin') respond(['error' => 'Keine Berechtigung.'], 403); +} + $cfg = require __DIR__ . '/config.php'; try { @@ -870,6 +878,46 @@ try { respond(['ok' => true]); break; + // ── Fake-Werbung (Admin-Joke) ───────────────────────────────── + case 'fake_ads': + // Γ–ffentlich: aktive Fake-Ads fΓΌrs Polling im Frontend + $rows = $pdo->query('SELECT id, image_url, target_url FROM gtl_fake_ads WHERE is_active=1 ORDER BY id DESC')->fetchAll(); + respond(['ok' => true, 'ads' => $rows]); + break; + + case 'fake_ads_all': + requireAdminApi($pdo, $authUserId); + $rows = $pdo->query('SELECT id, image_url, target_url, is_active, created_at FROM gtl_fake_ads ORDER BY id DESC')->fetchAll(); + respond(['ok' => true, 'ads' => $rows]); + break; + + case 'fake_ad_create': + requireAdminApi($pdo, $authUserId); + $body = input(); + $img = substr(trim((string) ($body['image_url'] ?? '')), 0, 500); + $target= substr(trim((string) ($body['target_url'] ?? '')), 0, 500); + if ($img === '') respond(['error' => 'Bild-URL erforderlich.'], 400); + $pdo->prepare('INSERT INTO gtl_fake_ads (image_url, target_url, is_active, created_at) VALUES (?,?,1,?)') + ->execute([$img, $target !== '' ? $target : null, $now]); + respond(['ok' => true, 'id' => (int) $pdo->lastInsertId()]); + break; + + case 'fake_ad_toggle': + requireAdminApi($pdo, $authUserId); + $body = input(); + $id = (int) ($body['id'] ?? 0); + $pdo->prepare('UPDATE gtl_fake_ads SET is_active = 1 - is_active WHERE id = ?')->execute([$id]); + respond(['ok' => true]); + break; + + case 'fake_ad_delete': + requireAdminApi($pdo, $authUserId); + $body = input(); + $id = (int) ($body['id'] ?? 0); + $pdo->prepare('DELETE FROM gtl_fake_ads WHERE id = ?')->execute([$id]); + respond(['ok' => true]); + break; + default: respond(['error' => 'Unbekannte Aktion.'], 400); } diff --git a/play.html b/play.html index 719c38e..2b3a743 100644 --- a/play.html +++ b/play.html @@ -429,6 +429,17 @@ 100%{opacity:0;transform:translateY(-70vh) scale(.8)} } + /* ── Fake-Werbung (Joke-Skyscraper am Bildschirmrand) ───── */ + .fake-ad{position:fixed;top:80px;width:160px;height:600px;max-height:calc(100vh - 120px);z-index:40; + border:1px solid var(--line);border-radius:14px;overflow:hidden;background:var(--bg2);box-shadow:var(--shadow)} + .fake-ad-left{left:12px} + .fake-ad-right{right:12px} + .fake-ad a{display:block;width:100%;height:100%} + .fake-ad img{width:100%;height:100%;object-fit:cover;display:block} + .fake-ad .ad-tag{position:absolute;top:6px;left:6px;font-size:9px;font-weight:700;color:#fff; + background:rgba(20,30,60,.6);padding:2px 6px;border-radius:6px;letter-spacing:.5px} + @media(max-width:1300px){.fake-ad{display:none}} + /* ── App-Shell auf Desktop: alles auf 1 Bildschirm, nur intern scrollen ── */ @media(min-width:861px){ html,body{height:100vh;height:100dvh;overflow:hidden} @@ -732,6 +743,10 @@ + + + + + + +