The Pligg CMS comes with many great components, SPAM protection isn’t one of them. As with previous versions, Pligg developers have decided SPAM protection isn’t important. Fellow members have come up with great solutions including our submit anti-spam solution but they ignored it.We released a way to prevent spam subissions by robots in version 9.9.5 that has worked magically for owners of the 9.9.5 version.
The modules works pretty well the same for version 1.0, why haven’t the developers adopted this method? Who knows.
Here is how to do it for you 1.0 owners:
Step 1: open submit_step_1.tpl
Find:
<form action="{$URL_submit}" method="post" id="thisform">
<label for="url">{#PLIGG_Visual_Submit1_NewsURL#}:</label>
<input type="text" name="url" id="url" value="http://" size="55" />
{checkActionsTpl location="tpl_pligg_submit_step1_end"}
<input type="hidden" name="phase" value=1/>
<input type="hidden" name="randkey" value="{$submit_rand}"/>
<input type="hidden" name="id" value="c_1"/>
</form>
After, add:
{php}
require_once(‘recaptchalib.php’);
$publickey = "PUBLICKEY"; // you got this from the signup page
echo recaptcha_get_html($publickey);
{/php}
Step 2: open submit.php
Find:
function do_submit1() {
global $main_smarty, $db, $dblang, $current_user, $the_template;
after, add:
if(enable_captcha == ‘true’) {
require_once(‘recaptchalib.php’);
// Get a key from http://recaptcha.net/api/getkey
$publickey = "6LcgbAIAAAAAAI9nYv__8BgVklHK71UijWSTbIP4 ";
$privatekey = "6LcgbAIAAAAAAMUqdB3ROC19UhxV6KcAgh34Gtq_";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "Succesfully verified that you are human.";
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
if (!$resp->is_valid) { // if incorrect captcha code was entered
$main_smarty->assign(’register_error_text’, "badcode");
$main_smarty->display($the_template . ‘/submit_errors.tpl’);
return;
}
// fin capthca
Find:
// submit step 2
function do_submit2() {
replace with:
// submit step 2
function do_submit2() {
Download the latest reCaptcha library from here and upload to your “root”.
![]()
You will also need reCaptcha keys for your site, you will need to register and add your site to reCaptcha. Register here.
In the above snippets, retype all instances of the single apostraphe ( ‘ ) as they are not appearing properly here. In the download they will appear properly however.
If the user/bot fails to enter the correct reCaptcha code, they will be forwarded to your error page controlled by submit_errors.tpl, I have not come with a custom error message for this, maybe someone can submit one.
This should eliminate almost all spam submissions.
