Here I am sharing complete guide for Google Recaptcha on Signup Page of Social Engine 3, I have tested on Social Engine 3.17 and working 100% Perfect. Follow the instructions carefully , You can get your Public and Private Key from here
https://www.google.com/recaptcha/
Just replace the following area with your PUBLIC KEY and PRIVATE KEY
YOUR_RECAPTHA_PRIVATE_KEY => Your PRIVATE KEY FROM GOOGLE RECAPTCHA WEBSITE
YOUR_RECAPTHA_PUBLIC_KEY => Your PUBLIC KEY FROM GOOGLE RECAPTCHA WEBSITE
Open SIGNUP.PHP
Find This
PHP:
// RETRIEVE AND CHECK SECURITY CODE IF NECESSARY
if($setting['setting_signup_code'] != 0)
{
// NOW IN HEADER
//session_start();
$code = $_SESSION['code'];
if($code == "") { $code = randomcode(); }
$signup_secure = $_POST['signup_secure'];
if($signup_secure != $code)
{
$is_error = 708;
}
}
And Replace it By
PHP:
// RETRIEVE AND CHECK SECURITY CODE IF NECESSARY
if($setting['setting_signup_code'] != 0)
{
// NOW IN HEADER
if ( $_POST["recaptcha_challenge_field"] )
{
if ( $_COOKIE[recaptcha_cooked] == $_POST["recaptcha_challenge_field"] )
{
setcookie("recaptcha_cooked", $_POST["recaptcha_challenge_field"],time() - 24*60*60,'/');
$code_found = true;
}
else
{
require_once('recaptchalib.php');
$privatekey = "YOUR_RECAPTHA_PRIVATE_KEY";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification
$code_found = true;
}
}
}
}
NOW FIND
// ASSIGN VARIABLES AND INCLUDE FOOTER
ADD THESE JUST BELOW IT
PHP:
require_once('recaptchalib.php');
$publickey = "YOUR_RECAPTHA_PUBLIC_KEY"; // you got this from the signup page
$smarty->assign('recaptcha',recaptcha_get_html($publickey));
$smarty->assign('recaptcha_challenge_field', $_POST[recaptcha_challenge_field]);
$smarty->assign('recaptcha_response_field', $_POST[recaptcha_response_field]);
Now Open SIGNUP.TPL
Find this line
PHP:
<input type='hidden' name='signup_cat' value='{$signup_cat}'>
and these lines below it
PHP:
<input type='hidden' name='recaptcha_challenge_field' value='{$recaptcha_challenge_field}'>
<input type='hidden' name='recaptcha_response_field' value='{$recaptcha_response_field}'>
Now Find this
PHP:
<td><input type='text' name='signup_secure' class='text' size='6' maxlength='10'> </td>
<td>
<table cellpadding='0' cellspacing='0'>
<tr>
<td align='center'>
<img src='./images/secure.php' id='secure_image' border='0' height='20' width='67' class='signup_code'>
<a href="javascript:void(0);" onclick="$('secure_image').src = './images/secure.php?' + (new Date()).getTime();">{lang_print id=975}</a>
</td>
<td>{capture assign=tip}{lang_print id=691}{/capture}<img src='./images/icons/tip.gif' border='0' class='Tips1' title='{$tip|escape:quotes}'></td>
</tr>
</table>
</td>
And Replace it by
PHP:
<td height=100>{$recaptcha}</td>
Dont Forget to replace your public and private key in the code give above
YOUR_RECAPTHA_PRIVATE_KEY
YOUR_RECAPTHA_PUBLIC_KEY
Now Unzip The Attahed File and Upload it Your Social Engine Root Folder
recaptchalib.php
Now Clear Your Social Engine Cache
delete all from from location
/include/smarty/templates_c
except the file index.php