guestbook: reject non-htmx POSTs (stops direct-POST spam bots)
Deploy / deploy (push) Successful in 41s

This commit is contained in:
2026-11-16 18:46:38 +01:00
parent 618d8254f1
commit 4ecc7c8869
+4 -1
View File
@@ -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.';