progetto di prova che mostra le macchine fiat e un form che permette di contattare
filippo.bertilotti
2024-05-03 22c81cf3ea881e1c8bb0c6d3f95590fdfea6e906
aggiunta controllo dello spam e implementazione template annesso
1 files added
1 files modified
50 ■■■■■ changed files
htdocs/contact.php 33 ●●●●● patch | view | raw | blame | history
ihtml/avviso.tpl 17 ●●●●● patch | view | raw | blame | history
htdocs/contact.php
@@ -46,32 +46,19 @@
    function controlloSpamEmail(mysqli $connection, string $email) {
        $esitoSpamEmail = false;
        $spam = false;
        $query = "SELECT email, dtm_richiesta FROM Contact WHERE email = '$email' AND dtm_richiesta BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW();";
        
        
        $result = $connection->query($query);
        
        while ($row = $result->fetch_assoc()) {
            echo $row['email']."<br />\n";
            echo $row['dtm_richiesta']."<br />\n";
        $rowcount=mysqli_num_rows($result);
        if ($rowcount > 0) {
            $spam = true;
        }
        while ($row = $result->fetch_assoc()) {
            if(count($row['email']) > 0) {
                $esitoSpamEmail = true;
            }
        }
        if($esitoSpamEmail == true) {echo "email spammata";}
        return $esitoSpamEmail;
        return $spam;
    }
    
@@ -85,9 +72,15 @@
            } catch (Exception $e) {
                die($e->getMessage());
            }
            controlloSpamEmail($conn, $email);
            if(controlloSpamEmail($conn, $email)) {
                $smarty->display('avviso.tpl');
                exit;
            }
            $esitoInserimento = insertDataOnTable($conn, $email, $number);
            if($esitoInserimento == true) {
                $smarty->display('conferma.tpl');
                exit;
ihtml/avviso.tpl
New file
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tipo</title>
    <link rel="stylesheet" href="files_comuni/style/style.css">
</head>
<body>
    {include file="header.tpl"}
    <main>
        {* messaggio di avviso *}
        Hai giĆ  sottomesso una richiesta, ti richiameremo a breve.
    </main>
    {include file="footer.tpl"}
</body>
</html>