Added web form capabilities to a client's existing static HTML site.
- Form is protected by ReCAPTCHA
- Relays POST data to CGI Email for processing
- Supports email confirmation & notifications
Completion Date
Code Snippet
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be87875 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.htaccess +.htpasswd +ralphrob-dev/ diff --git a/.htaccess b/.htaccess deleted file mode 100644 index 13fd075..0000000 --- a/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -# Use PHP54 Single php.ini as default -AddHandler application/x-httpd-php54s .php diff --git a/acknowledge.php b/acknowledge.php new file mode 100644 index 0000000..9e9e253 --- /dev/null +++ b/acknowledge.php @@ -0,0 +1,42 @@ +<html> +<body> + +<?php +/** + * This php file takes Contact Form submission data, validates the data against + * Google ReCaptcha spam detection services, then relays it to CGI Email for + * processing. +**/ + +if (isset($_POST['Submit']) && $_POST['g-recaptcha-response'] != null) { + $url = 'http://dev.ralphrobbinsdds.com/cgi-bin/cgiemail/contact_form_template.txt'; + $options = array( + 'http' => array( + 'header' => "Content-type: application/x-www-form-urlencoded\r\n", + 'method' => 'POST', + 'content' => http_build_query($_POST), + ) + ); + + $context = stream_context_create($options); + $result = file_get_contents($url, false, $context); +} +?> + +<?php if (isset($result) && $result != false) { ?> + <h1>Thank You</h1> + <p>Your message has been sent.</p> + <p><a href="<?php echo $_SERVER['HTTP_REFERER'] ?>">Return to RalphRobbinsDDS.com</a></p> +<?php } else { ?> + <h1>Oops!</h1> + <p>Sorry, there was a problem sending your message.</p> + <button onclick="goBack()">Go Back</button> + <script> + function goBack() { + window.history.back(); + } + </script> +<?php } ?> + +</body> +</html> diff --git a/cgi-bin/cgiecho b/cgi-bin/cgiecho new file mode 100755 index 0000000..c7e41de Binary files /dev/null and b/cgi-bin/cgiecho differ diff --git a/cgi-bin/cgiemail b/cgi-bin/cgiemail new file mode 100755 index 0000000..bd69b03 Binary files /dev/null and b/cgi-bin/cgiemail differ diff --git a/cgi-bin/entropybanner.cgi b/cgi-bin/entropybanner.cgi new file mode 100755 index 0000000..a316764 Binary files /dev/null and b/cgi-bin/entropybanner.cgi differ diff --git a/cgi-bin/randhtml.cgi b/cgi-bin/randhtml.cgi new file mode 100755 index 0000000..98a2764 Binary files /dev/null and b/cgi-bin/randhtml.cgi differ diff --git a/contact.html b/contact.html index 98f7302..5e8db2f 100644 --- a/contact.html +++ b/contact.html @@ -4,11 +4,12 @@ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="css/style.css" media="all" /> <link rel="stylesheet" type="text/css" href="css/pages.css" media="all" /> -<link rel="stylesheet" href='slideshow.css' type="text/css" /> -<script type="text/javascript" src="xfade2.js"></script> +<!-- <link rel="stylesheet" href='slideshow.css' type="text/css" /> --> +<!-- <script type="text/javascript" src="xfade2.js"></script> --> <title>Ralph N. Robbins DDS | Orthodontist | Contact Us</title> <meta name="description" content="Our mission is to deliver excellent orthodontic care in a friendly, relaxed and professional atmosphere. Your comfort is our paramount concern and we will do everything possible to make our long-term relationship a caring and worry-free one."> <meta name="keywords" content="orthodontist, dentist, chicago, braces, treatment, ralph, robbins, dds, pediatric, treatment, smile, mouth, tooth, teeth, office, insurance"> +<script src='https://www.google.com/recaptcha/api.js'></script> </head> <body> <div id="fb-root"></div> @@ -76,40 +77,25 @@ <div id="content-right"> <strong>If you have a comment or question, please fill out the form below.</strong> - - - - <form action="mailto:team@ralphrobbinsdds.com" method="POST" enctype="multipart/form-data" name="ContactForm"> - - -<p>Full Name:</p> - - - -<p><input type="text" name="name" size="50"></p> - - -<p>Email Address:</p> - - -<p><input type="text" name="email" size="50"></p> - -<p>Phone Number:</p> - - -<p><input type="text" name="phone" size="50"></p> - -<p>Question/Comment:</p> - -<p><textarea name="comment" cols="50" wrap="virtual" rows="5"></textarea></p><br /> - - - -<input type="submit" name="Submit" value="Submit"> +<!-- <form action="http://dev.ralphrobbinsdds.com/cgi-bin/cgiemail/contact_form_template.txt" method="POST" name="ContactForm"> --> +<form action="acknowledge.php" method="POST" name="ContactForm"> + <p>*Full Name:</p> + <p><input type="text" name="required-name" size="50"></p> + <p>Email Address:</p> + <p><input type="text" name="email" size="50"></p> + <p>Phone Number:</p> + <p><input type="text" name="phone" size="50"></p> + <p>Question/Comment:</p> + <p><textarea name="comment" cols="50" wrap="virtual" rows="5"></textarea></p><br /> + <div class="g-recaptcha" data-sitekey="6LfzQhUTAAAAADc-69GgOCO5c_bl0nDTO4_xgGd6"></div> + <input type="hidden" name="addendum" value="Thank you!"> + <input type='hidden' name='cgiemail-mailopt' value='sync'> + <input type="submit" name="Submit" value="Submit"> </form> + <hr /><br /> <iframe width="609" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d94806.69187143994!2d-87.90768943164528!3d42.04941742386485!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x880fc80ce79ff295%3A0x66706ccf22bd0434!2sGolf+Mill+Shopping+Center!5e0!3m2!1sen!2sus!4v1444522089545"></iframe><br /><small><a href="https://www.google.com/maps/place/Golf+Mill+Shopping+Center/@42.0494174,-87.9076894,12z/data=!4m2!3m1!1s0x880fc80ce79ff295:0x66706ccf22bd0434" target="_blank" style="color:#0000FF;text-align:left">View Larger Map</a></small> diff --git a/contact_form_template.txt b/contact_form_template.txt new file mode 100644 index 0000000..0b9188a --- /dev/null +++ b/contact_form_template.txt @@ -0,0 +1,8 @@ +From: webmaster@ralphrobbinsdds.com +To: ericexeljenkins@gmail.com +Subject: Form submission from RalphRobbinsDDS.com + +Full Name: [required-name] +Email Address: [email] +Phone Number: [phone] +Question/Comment: [comment]