From 4ecc7c88697f49895009b8af46fdb813a0bbd02f Mon Sep 17 00:00:00 2001 From: 0xA0 Date: Mon, 16 Nov 2026 18:46:38 +0100 Subject: [PATCH] guestbook: reject non-htmx POSTs (stops direct-POST spam bots) --- guestbook.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/guestbook.php b/guestbook.php index 5cb77c7..bdc4769 100644 --- a/guestbook.php +++ b/guestbook.php @@ -33,7 +33,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $trap = trim($_POST['url'] ?? ''); $ok = false; - if ($trap !== '') { + // bots POST name/msg straight to this endpoint, skipping the htmx form and + // its honeypot. Real signs come via hx-post (HX-Request header); treat any + // non-htmx POST like a honeypot hit — fake success, insert nothing. + if ($trap !== '' || !$isHtmx) { $ok = true; } elseif ($name === '' || $msg === '') { $notice = 'name and message are required.';