| | |
| | | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | |
| | |
| | | } 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'); |