EXPLOREYOURBRAINISM

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

Currently Viewing Posts Tagged php-fusion

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.

Captcha Validation In Comment For Registered Member in PHP-Fusion V7

Belom lama ini xyb kena SpamBot di bagian Komentar Menu Artikel, kenapa bisa kena? karna saat mengirim komentar tidak ada Nomer Unique untuk melakukan verifikasi (bahasa kerennya skrng itu Captcha).

Secara default pengunjung yang udah register bisa langsung posting komentar tanpa adanya validation code, dulu gw pikir ini aman, aman dalem arti jauh dari serangan spambot, ternyata salah, buktinya bisa lu liat sendiri gambar diatas yg udah register aja bisa nyembarin ’sampah’ ga jelas di komentar.
Salah satu cara untuk mencegah terjangkitnya spambot yaitu gw harus memvalidasi posting komentar yg ada di Menu artikel/news menggunakan Unique Number (validation code / captcha image).  Cara ngerombak PHP-Fusionnya akan gw bahas tuntas dibawah ini.
1. Buka file /include/comments_include.php
cari potongan code $comment_name = $userdata[‘user_id’];
kl udah ketemu, tambahkan potongan kode dibawah ini.

include_once INCLUDES.”securimage/securimage.php”;
$securimage = new Securimage();
if (!isset($_POST[‘com_captcha_code’]) || $securimage->check($_POST[‘com_captcha_code’]) == false) { redirect($link); }

masih di file yg sama (/include/comments_include.php) cari lagi potongan code echo display_bbcodes(“360px”, “comment_message”);

kl udah ketemu, tambahkan potongan kode dibawah ini.

echo $locale[‘global_158’].”
\n”;
echo “”
\n”;
echo “”\n”;
echo “Post Optionsment.getElementById(‘com_captcha’).src = ‘”.INCLUDES.”securimage/securimage_show.php?sid=’ + Math.random(); return false\”>”
\n”;
echo $locale[‘global_159’].”
\n\n”;

Dah selsai, codingnya cuma segitu doang kok, ga ribet kan. sekarang kl gw Login trus ngeliat article or news akan ada tambahan validation code untuk ngirim komentar. like picture above.

Mudah2an kebal spambot. hahahahha

  • Recent Posts

  • Recent Comments

  • Archives