[MOD] Stop review spam disabling captcha
Posted: Thu Jul 01, 2010 4:58 pm
I've noticed a high incidence of customers trying to contact me using the Contact form but the Captcha system is so poor that many don't find it easy to read and I lose out on sales. Unfortunately the Captcha setting also determines whether you use it for reviews which I DO want to have because the spam bots are constantly hitting that function.
So, quick and dirty "fix" to enable Captcha for reviews but disable for everything else.
Open: includes/display/ProductReviews.php
Find:
Replace with:
Pre 6.x
Open: includes/classes/class.review.php
6.x or later
Open: modules/comments/builtincomments/module.builtincomments.php
Find:
Replace with:
So, quick and dirty "fix" to enable Captcha for reviews but disable for everything else.
Open: includes/display/ProductReviews.php
Find:
Code: Select all
if (GetConfig('CaptchaEnabled') == false) {
$GLOBALS['HideReviewCaptcha'] = "none";
}
else {
// Generate the captcha image
$GLOBALS['ISC_CLASS_CAPTCHA'] = GetClass('ISC_CAPTCHA');
$GLOBALS['ISC_CLASS_CAPTCHA']->CreateSecret();
$GLOBALS['CaptchaImage'] = $GLOBALS['ISC_CLASS_CAPTCHA']->ShowCaptcha();
}
Code: Select all
// Generate the captcha image
$GLOBALS['ISC_CLASS_CAPTCHA'] = GetClass('ISC_CAPTCHA');
$GLOBALS['ISC_CLASS_CAPTCHA']->CreateSecret();
$GLOBALS['CaptchaImage'] = $GLOBALS['ISC_CLASS_CAPTCHA']->ShowCaptcha();
Open: includes/classes/class.review.php
6.x or later
Open: modules/comments/builtincomments/module.builtincomments.php
Find:
Code: Select all
// Do we need to check captcha?
if(GetConfig('CaptchaEnabled') && isc_strtolower($captcha) != isc_strtolower($GLOBALS['ISC_CLASS_CAPTCHA']->LoadSecret())) {
$_SESSION['productReviewData'] = $reviewPostData;
FlashMessage(GetLang('ReviewBadCaptcha'), MSG_ERROR, $prodReviewsLink, 'reviews');
exit;
}
Code: Select all
// Do we need to check captcha?
if(isc_strtolower($captcha) != isc_strtolower($GLOBALS['ISC_CLASS_CAPTCHA']->LoadSecret())) {
$_SESSION['productReviewData'] = $reviewPostData;
FlashMessage(GetLang('ReviewBadCaptcha'), MSG_ERROR, $prodReviewsLink, 'reviews');
exit;
}