From 051dad24191c95f2e8a4df4a8112f36df0ee1370 Mon Sep 17 00:00:00 2001 From: jrtechs Date: Sun, 17 Jun 2018 18:01:10 -0400 Subject: [PATCH] Added contact form to portfolio website --- contactform.php | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ index.html | 36 ++++++++++++++++++++++--- 2 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 contactform.php diff --git a/contactform.php b/contactform.php new file mode 100644 index 0000000..d15c293 --- /dev/null +++ b/contactform.php @@ -0,0 +1,72 @@ + '6LceWF8UAAAAAGueUiQyI-W_saWPInFfLW6nM8pv', + 'response' => $_POST["g-recaptcha-response"] + ); + $options = array( + 'http' => array ( + 'method' => 'POST', + 'content' => http_build_query($data) + ) + ); + $context = stream_context_create($options); + $verify = file_get_contents($url, false, $context); + $captcha_success=json_decode($verify); + + if ($captcha_success->success==false) + { + echo "

You are a bot! Go away!

"; + } + else if ($captcha_success->success==true) + { + $fromName = stripslashes($_POST["name"]); + $fromEmail = stripslashes($_POST["email"]); + $subject = "Jrtechs.me Form Submission - " . $fromEmail; + $emailMessage = stripslashes($_POST["message"]); + $message = "Message from contact form on jrtechs.me\nName: + $fromName \nEmail:\n$fromEmail \nMessage:\n$emailMessage"; + $headers = "From: $fromEmail"; + $response = $_POST[g-recaptcha-response]; + + + mail($toEmail, $subject, $message, $headers); + header('Location:https://jrtechs.me/index.html'); + } + } + + } +} \ No newline at end of file diff --git a/index.html b/index.html index dd35680..67528d4 100755 --- a/index.html +++ b/index.html @@ -249,9 +249,36 @@

Contact Me


-
-

Jeffery@jrtechs.net

-
+ +
+
+
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+
+ + +
+
+
+
+
+
@@ -861,6 +888,9 @@ + + +