addressalign-toparrow-leftarrow-leftarrow-right-10x10arrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblightning-boltlinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstar-shapestartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Message boards will no longer be available after July 18, 2024.

We recommend saving any important information beforehand. Going forward, you can stay connected with your groups using the Discussions feature (we'll be rolling out some exciting updates soon)!

Learn more about the upcoming changes in this article;

Creating a contact form (Is it working?)

From: max s.
Sent on: Thursday, August 11, 2016, 9:23 AM
I’m trying to create a form handler which i’ll use for several pages (so this will ultimately become a class i guess? or at least a function). Right now i’m in the early stage and trying to incorporate a no-captcha and i’m not sure it’s working.

No matter what i do or don’t enter into the form, if i check the captcha or not, it seems to submit. The only time it does not is if i don’t enter an email in proper email syntax (thank you HTML5/CSS)

My goal is to create a form handler that will screen out spam (if someone is submitting something with a url, nuke it, if it’s not real email, nuke it, etc).





Thanks as always folks
- M









Full script (minus my keys)
<?php

/*
reCAPTCHA is a free CAPTCHA service that protect websites from spam and abuse. This is Google authored code that provides plugins for third-party integration with reCAPTCHA.
*/

require_once "./_inc/recaptchalib_inc.php";

$publickey = “xxxxxxx";
$privatekey = “yyyyyyy";


/*
#CONFIG
$toAddress = "[address removed], [address removed], [address removed]";  //client's email
$toName = "Marvel Champions"; //place your client's name here
$website = "Marvel-Champions";  //place NAME of your client's website here
$sendEmail = TRUE; //if true, will send an email, otherwise just show user data.

$sendto = "[address removed], [address removed]";
$submited = "website mail";
*/


if(isset($_POST['submit']))
{
 $email=$_POST['email'];
 $comment=$_POST['comment'];
 $captcha=$_POST['g-recaptcha-response'];


 if(!$captcha)
 {
echo 'Please check the the captcha form.';
 }

. $privatekey . "}&response="
. $captcha . "&remoteip="
. $_SERVER['REMOTE_ADDR']);

 if($response.success==false) {
echo "Thank you for your message.";
} else {
echo 'Comment sent!';
}
}


foreach ($_POST as $key => $value) {
echo '<p><strong>' . $key.':</strong> '.$value.'</p>';
}


$SpamErrorMessage = "Sorry - No Website URLs Permitted";
if (preg_match("/http/i", "$name")) {echo "&spamErrorMessage"; exit();}

if (preg_match("/http/i", "$email")) {echo "&spamErrorMessage"; exit();}

if (preg_match("/http/i", "$message")) {echo "&spamErrorMessage"; exit();}





?>



<html>
<head>
</head>
<body>

<? var_dump($_POST) ; ?>
<h1>Test reCAPTCHA</h1>
<form action="" method="post">
<label>Email</label>
<div>
<input name="email" type="email" placeholder="Type Your Email" size="39" />
</div>

<br>

<label>name</label>
<div>
<input name="name" type="text" placeholder="Type Your Email" size="39" />
</div>

<br>

<label>Comment</label>

<div>
<textarea name="$message" cols="40" rows="5" placeholder="Type You Comment..."></textarea>
</div>

<br>

<div class="g-recaptcha" data-sitekey="<? $publicKey ; ?>"></div>

<input type="submit" value="submit" />
</form>



</body>
</html>

People in this
group are also in: