EXPLOREYOURBRAINISM

Just shares about life-networking-programing-ebook-computer-*nix-music-religion and more…

Patch Recaptcha PHP-Fusion 7 For Defending Spambot Attack

This is Step By Step to Patch Recaptcha into your PHP-Fusion 7 Comment Form.

1. Get Public & Private Key from http://www.google.com/recaptcha

2. Download the Recaptcha library from here extract recaptchalib.php & upload to directory www[dot]yoursite[dot]com/includes/

3. edit file “comments_include.php” from www[dot]yoursite[dot]com/includes/ directory

4. Find this line (line 39)

if (iMEMBER) {
$comment_name = $userdata[‘user_id’];

Add this code after it

//Update By EVA-00 For patch Recaptcha
//Start Here
require_once BASEDIR.”includes/recaptchalib.php”;
$privatekey = “inpur-your-private-key”; //you got this key from the signup page
$resp = recaptcha_check_answer ($privatekey,
$_SERVER[“REMOTE_ADDR”],
$_POST[“recaptcha_challenge_field”],
$_POST[“recaptcha_response_field”]);
if (!$resp->is_valid) {
{redirect($link);}
}
//End Here

5. the last one, find this line ( line 165)

echo display_bbcodes(“360px”, “comment_message”);

Add this code after it

//Update By EVA-00 For patch Recaptcha
//Start Here
echo “<br />”.$locale[‘global_158’].”<br /><br />”;
require_once BASEDIR.”includes/recaptchalib.php”;
$publickey = “Input-Your-Public-key”; // you got this key from the signup page
echo recaptcha_get_html($publickey);
//End Here

Done, you can download full script here and modify it as you want.

1 Comment


Leave a Reply

Your email address will not be published. Required fields are marked *

  • Recent Posts

  • Recent Comments

  • Archives