From 3b2e04f16a595893e8736a9b816bad81ecc8bf6a Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Fri, 12 Mar 2010 21:46:15 -0500 Subject: Added working CAPTCHA After a little digging, it turned out that the reason that reCAPTCHA always failed was because the reCAPTCHA server was blocked to the server. This should've been obvious as the reCAPTCHA always worked on the development server. --- pages/post.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'pages') diff --git a/pages/post.php b/pages/post.php index 121435a..fd826a5 100755 --- a/pages/post.php +++ b/pages/post.php @@ -21,9 +21,7 @@ if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} require('headerproc.php'); - -include('includes/recaptchalib.php'); -$privatekey = "6LfgvgEAAAAAAD0_UVLp57MU7tqcypsbZPS9qTnr"; +require('includes/securimage/securimage.php'); if (!isset($_POST['id'])) { @@ -41,10 +39,11 @@ if (!isset($_POST['id'])) } else { if (preg_match('/^[A-Za-z0-9!#$&\'*+-\/=?^_`{|}~]+@[-A-Za-z0-9]+(\.[-A-Za-z0-9]+)+[A-Za-z]$/', $_POST['email'])) { - $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); - if (!$resp->is_valid) + $img = new Securimage; + + if ($img->check($_POST['code']) == false) { - die('The reCAPTCHA wasn\'t entered correctly. Go back and try it again.'); + die('The CAPTCHA wasn\'t entered correctly. Go back and try it again.'); } else { $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $_POST['username'] . "\""; $getanon2 = mysql_query($getanon); -- cgit 1.4.1