diff options
-rw-r--r-- | app/controllers/contact.controller.php | 7 | ||||
-rw-r--r-- | app/model/Form.php | 9 | ||||
-rw-r--r-- | public/css/tdro.css | 2 |
3 files changed, 5 insertions, 13 deletions
diff --git a/app/controllers/contact.controller.php b/app/controllers/contact.controller.php index 504b979..797cccd 100644 --- a/app/controllers/contact.controller.php +++ b/app/controllers/contact.controller.php @@ -10,19 +10,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $form->spam = $spam = $_POST['agree'] ?? false; if ($form->empty()) { - include '../app/views/contact.view.php'; - return; + return http_response_code(403); } if ($form->spam()) { - error_log('Contact Form Spam: Error 403'); return http_response_code(403); } if ($form->emailValid() === false) { $emailError = 'Invalid email: ' . "\r" . '<b>'. $email . '</b>'; - include '../app/views/contact.view.php'; - return; + return include '../app/views/contact.view.php'; } $formSuccess = true; diff --git a/app/model/Form.php b/app/model/Form.php index 6520a9c..e55eadc 100644 --- a/app/model/Form.php +++ b/app/model/Form.php @@ -23,6 +23,7 @@ class Form if ((bool) empty($this->email) == true || (bool) empty($this->message) == true ) { + error_log('Contact Form Incomplete: Error 403'); return true; } } @@ -34,14 +35,11 @@ class Form public function submit() { - // Include mail config $config = include '../config.php'; $mail = new PHPMailer(true); try { - //Server settings - //$mail->SMTPDebug = 2; $mail->isSMTP(); $mail->SMTPAuth = true; $mail->SMTPSecure = 'ssl'; @@ -50,21 +48,18 @@ class Form $mail->Username = $config['mail']['username']; $mail->Password = $config['mail']['password']; - //Recipients $mail->setFrom($config['mail']['username'], $config['mail']['name']); $mail->addAddress($config['mail']['username'], $config['mail']['name']); - //Content $mail->isHTML(true); $mail->Subject = 'New message from ' . $this->email; $mail->Body = $this->message . "\n\n" . $this->name . "\n" . $this->email; $mail->AltBody = $this->message . "\n\n" . $this->name . "\n" . $this->email; - //Send Mail $mail->send(); } catch (Exception $exception) { - log_exception($exception); + error_log($exception); } } } diff --git a/public/css/tdro.css b/public/css/tdro.css index 07a899f..354de32 100644 --- a/public/css/tdro.css +++ b/public/css/tdro.css @@ -3953,7 +3953,7 @@ html.has-navbar-fixed-top, body.has-navbar-fixed-top, html.has-navbar-fixed-bott */ .alert { color: #f00; } -.agree { display: none; } +.agree { opacity: 0; position: absolute; top: 0; left: 0; height: 0; width: 0; z-index: -1; } .message__success { background-color: #effaef; padding: 1em; |