Claus Heinrich

Scuttle Spam – reCAPTCHA Scuttle Bookmarking Script

Stop the SPAM! Those who use or own a Scuttle site know the spambot problem all to well. I also got sick and tired of the removal of all the spam users + bookmarks through MySQL.
And since the developer didn’t want to make the step to put some minimal defence on this system, I had to. Either that or totally abandon the script.

Scuttle Spam Protection with reCAPTCHA
In this post I will show an example of how to protect your Scuttle script a little better, with the use of reCAPTCHA. It is pretty easy and can be implemented within minutes. (This does not guarantee you will be rid of spam, but should put a pretty good plug in the hole)

Remember to backup all files before you do this. I will not be responsible for people messing up the code.

First register for an account at reCAPTCHA to get your public and private key.
Download their ZIP file containing  recaptchalib.php (Upload recaptchalib.php to your Scuttle Root)

Then open your register.php and insert this:

[code lang=”php”]
require_once(‘recaptchalib.php’);
$privatekey = “PUT YOUR PRIVATE KEY HERE”;
$resp = recaptcha_check_answer ($privatekey,
$_SERVER[“REMOTE_ADDR”],
$_POST[“recaptcha_challenge_field”],
$_POST[“recaptcha_response_field”]);
if (!$resp->is_valid) { // if both captchas don’t match
$error = true;
$tplVars[‘error’] = T_(‘Wrong Code – Try Again!’);
}
[/code]

RIGHT BEFORE:

[code lang=”php”]
elseif ($userservice->addUser($posteduser, $_POST[‘password’], $_POST[’email’])) {
[/code]

Close and Upload.

Then open your /template/register.tpl.php and insert this:

[code lang=”php”]


[/code]

RIGHT BEFORE:

[code lang=”php”]

[/code]

Upload this file and you are done. Voila. (Remember to insert your own unique Public and Private Key)

Test your signup process and make sure everything looks good and works as it should.

FYI: WordPress makes some different single-quotation marks. You will need to manually replace the ‘ with a normal one. (I will look for a fix on this)

8 Comments

  1. Claus, we at Vidoop have a CAPTCHA solution that can be implemented in a similar fashion and may be easier on your readers. If you wish to check it out, our code is there and our main product page is my comment name. It is configurable too.

  2. Thanks, great post, awesome blog.

    ps; check out our forums Claus.

  3. I see reCaptcha on many websites and wonder why it is so popular. I use very easy way how to stop spam (and yes, on quite popular websites). I simply add a question like “how do you spell word “word” backwards?” and I didn’t get single spam from robot for many years.

Leave a Comment