From f805e7c0de2e380bd037938cf72b13de8ccec791 Mon Sep 17 00:00:00 2001 From: filippo.bertilotti <filippobertilotti@gmail.com> Date: Fri, 03 May 2024 10:35:01 +0200 Subject: [PATCH] aggiunta commenti --- htdocs/contact.php | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/contact.php b/htdocs/contact.php index 0a9020e..6cec6a4 100644 --- a/htdocs/contact.php +++ b/htdocs/contact.php @@ -13,6 +13,11 @@ $email = $_POST['email'] ?? ''; $msg = ''; + /* + * + * Inserisce i dati trasmessi dal form ($email e $number) nella tabella + * + */ function insertDataOnTable(mysqli $mysql, string $email, string $number) { $esitoInserimento = false; @@ -25,6 +30,15 @@ } return $esitoInserimento; } + + + /* + * + * + * controlla se ci sono errori sulla digitazione dei dati messi nel form + * + * + */ function controlloErrori(string $email, string $number, array &$errorMsgs) { if(!is_numeric($number) || strlen($number) != 10) { @@ -44,7 +58,13 @@ return $validazioneOk; } - + /* + * + * + * controlla se nelle 24 ore prima non sia stata messa nel campo email la stessa mail per evitarne lo spam + * + * + */ function controlloSpamEmail(mysqli $connection, string $email) { $spam = false; $query = "SELECT email, dtm_richiesta FROM Contact WHERE email = '$email' AND dtm_richiesta BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW();"; @@ -72,7 +92,7 @@ } catch (Exception $e) { die($e->getMessage()); } - + if(controlloSpamEmail($conn, $email)) { $smarty->display('avviso.tpl'); exit; -- Gitblit v1.8.0