From b78345e4c8068e66a7adbbdaa977d416b211b507 Mon Sep 17 00:00:00 2001 From: Jukka Lampikoski Date: Mon, 9 Mar 2026 21:12:09 +0200 Subject: [PATCH] =?UTF-8?q?Lis=C3=A4=C3=A4=20laskutoimituscaptcha=20tarjou?= =?UTF-8?q?spyynt=C3=B6lomakkeeseen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Satunnainen yhteenlaskukysymys (esim. "Paljonko on 3 + 5?") tarkistetaan sekä client- että serverpuolella. Vain sähköposti on nyt pakollinen kenttä. Co-Authored-By: Claude Opus 4.6 --- api.php | 12 ++++++++++-- tarjouspyynto.html | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/api.php b/api.php index ba34e9d..f76c64f 100644 --- a/api.php +++ b/api.php @@ -140,12 +140,20 @@ switch ($action) { exit; } + // Captcha + $captcha = trim($_POST['captcha'] ?? ''); + $captchaAnswer = trim($_POST['captcha_answer'] ?? ''); + if (!$captcha || $captcha !== $captchaAnswer) { + echo json_encode(['error' => 'Väärä vastaus varmistuskysymykseen.']); + exit; + } + // Validate $name = trim($_POST['name'] ?? ''); $email = trim($_POST['email'] ?? ''); - if (!$name || !$email) { - echo json_encode(['error' => 'Nimi ja sähköposti ovat pakollisia.']); + if (!$email) { + echo json_encode(['error' => 'Sähköposti on pakollinen.']); exit; } diff --git a/tarjouspyynto.html b/tarjouspyynto.html index 80554dc..bc80eb0 100644 --- a/tarjouspyynto.html +++ b/tarjouspyynto.html @@ -65,8 +65,8 @@
Yhteystiedot
- - + +
@@ -191,6 +191,14 @@
+ +
Varmistus
+
+ + + +
+