aboutsummaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorThedro Neely <thedroneely@gmail.com>2018-11-09 22:56:40 -0500
committerThedro Neely <thedroneely@gmail.com>2018-11-09 22:56:40 -0500
commit643f4d8b30d5b134ed72e36b8c4637985b31f077 (patch)
tree98d08676390cdd68fd886b747f6bdf33260f6710 /app/controllers
parent025f25acd89e05af5b32a47145849efba184559e (diff)
downloadthedroneely.com-643f4d8b30d5b134ed72e36b8c4637985b31f077.tar.gz
thedroneely.com-643f4d8b30d5b134ed72e36b8c4637985b31f077.tar.bz2
thedroneely.com-643f4d8b30d5b134ed72e36b8c4637985b31f077.zip
app/controllers/mail.controller: Add FastCGI finish to remove delay on contact form submit.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/mail.controller.php34
1 files changed, 24 insertions, 10 deletions
diff --git a/app/controllers/mail.controller.php b/app/controllers/mail.controller.php
index d22b487..8036093 100644
--- a/app/controllers/mail.controller.php
+++ b/app/controllers/mail.controller.php
@@ -1,19 +1,33 @@
<?php
+
+use PHPMailer\PHPMailer\PHPMailer;
+use PHPMailer\PHPMailer\Exception;
+
$form = new Form(
$name = $_POST['26471'],
$email = $_POST['26472'],
$message = $_POST['26478']
);
-$form->isSubmit();
+// $contact['database']->insert(
+// 'contactform', [
+// 'name' => $form->name,
+// 'email' => $form->email,
+// 'message' => $form->message,
+// ]
+// );
-// require '../app/views/mail-sent.view.php';
-// fastcgi_finish_request();
+$validEmail = PHPMailer::validateAddress($email, 'auto');
-$contact['database']->insert(
- 'contactform', [
- 'name' => $form->name,
- 'email' => $form->email,
- 'message' => $form->message,
- ]
-);
+if ($validEmail === false ) {
+ $mailError = 'Invalid email' . "\r" . '<em>'. $email . '</em>';
+ include '../app/views/mail-error.view.php';
+}
+
+die(var_dump($e));
+
+require '../app/views/mail-sent.view.php';
+
+fastcgi_finish_request();
+
+$form->isSubmit();