summary refs log tree commit diff stats
path: root/pages
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2010-03-12 21:46:15 -0500
committerStarla Insigna <hatkirby@fourisland.com>2010-03-12 21:46:15 -0500
commit3b2e04f16a595893e8736a9b816bad81ecc8bf6a (patch)
tree61449c358aa11efb776f8415a261bf712217c80e /pages
parent78570eed305682021c1791b1f44ca9235cfcb9ac (diff)
downloadfourisland-3b2e04f16a595893e8736a9b816bad81ecc8bf6a.tar.gz
fourisland-3b2e04f16a595893e8736a9b816bad81ecc8bf6a.tar.bz2
fourisland-3b2e04f16a595893e8736a9b816bad81ecc8bf6a.zip
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.
Diffstat (limited to 'pages')
-rwxr-xr-xpages/post.php11
1 files changed, 5 insertions, 6 deletions
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 @@
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} 21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22 22
23require('headerproc.php'); 23require('headerproc.php');
24 24require('includes/securimage/securimage.php');
25include('includes/recaptchalib.php');
26$privatekey = "6LfgvgEAAAAAAD0_UVLp57MU7tqcypsbZPS9qTnr";
27 25
28if (!isset($_POST['id'])) 26if (!isset($_POST['id']))
29{ 27{
@@ -41,10 +39,11 @@ if (!isset($_POST['id']))
41 } else { 39 } else {
42 if (preg_match('/^[A-Za-z0-9!#$&\'*+-\/=?^_`{|}~]+@[-A-Za-z0-9]+(\.[-A-Za-z0-9]+)+[A-Za-z]$/', $_POST['email'])) 40 if (preg_match('/^[A-Za-z0-9!#$&\'*+-\/=?^_`{|}~]+@[-A-Za-z0-9]+(\.[-A-Za-z0-9]+)+[A-Za-z]$/', $_POST['email']))
43 { 41 {
44 $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); 42 $img = new Securimage;
45 if (!$resp->is_valid) 43
44 if ($img->check($_POST['code']) == false)
46 { 45 {
47 die('The reCAPTCHA wasn\'t entered correctly. Go back and try it again.'); 46 die('The CAPTCHA wasn\'t entered correctly. Go back and try it again.');
48 } else { 47 } else {
49 $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $_POST['username'] . "\""; 48 $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $_POST['username'] . "\"";
50 $getanon2 = mysql_query($getanon); 49 $getanon2 = mysql_query($getanon);