Created
October 15, 2012 01:48
-
-
Save whackashoe/3890435 to your computer and use it in GitHub Desktop.
Verify IMLCaptcha Full Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 = "[email protected]"; | |
$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