Skip to content

Instantly share code, notes, and snippets.

@whackashoe
Created October 15, 2012 01:48
Show Gist options
  • Save whackashoe/3890435 to your computer and use it in GitHub Desktop.
Save whackashoe/3890435 to your computer and use it in GitHub Desktop.
Verify IMLCaptcha Full Code
<?php
require_once('imlcaptcha/IMLCaptchaReader.php');
$captcha = new IMLCaptchaReader();
$errors = array();
$success = False;
if(isset($_POST['submit'])) {
$captcha->validate($_POST['imlclookup'], $_POST['imlcinput']);
if(!isset($_POST['email']) || empty($_POST['email'])) $errors[] = "You must enter an email address so I can send you spam";
if(!isset($_POST['message']) || empty($_POST['message'])) $errors[] = "You forgot to enter a message... or was that your plan?";
if(!$captcha->checkSuccess()) $errors[] = "The captcha was incorrect, please try again";
if(count($errors) == 0) {
$to = "youremail@mail.com";
$from = $_POST['email'];
$subject = "IMLCaptcha";
$body = clean($_POST['email']) . " says " . $_POST['message'];
$headers = 'From: ' . $from . "\r\n" .
'Reply-To: ' . $from . "\r\n" .
'X-Mailer: PHP/' . phpversion();
sleep(3);
mail($to, $subject, $body, $headers);
$success = True;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment