How to protect Coppermine against SPAM

coppermine.jpgCoppermine is a great photo album. Unfortunately the scum of the world sends their spam to the most often used packages like Coppermine. I also started receiving spam on a Coppermine installation on one of my websites. I found a good solution in the Captcha plugin, prepared for Coppermin by Abbas Ali. After installing this, the user needs to type the letters he can read, but a bot can’t. Here’s howto.

Here’s the text that was originally posted here by Abbas Ali.

Thanks to Edward Eliot for PhpCaptcha class which is used by this mod.

What will this mod do?

  • Will show an image with some text while adding comment
  • User will be required to enter the text exactly as shown in image in the text box provided
  • If the text entered by user doesn’t matches with text shown on image then comment won’t be added

The mod

Files modified

  • db_input.php
  • themes/yourtheme/theme.php
  • lang/english.php

New Files

  • captcha.php
  • include/captcha.class.php
  • fonts

First extract the attached zip file and place captcha.php and fonts directory in your coppermine root directory. Place captcha.class.php in include directory.

Then edit lang/english.php

Add

Code:
'captcha_error' => 'The confirmation code didn't matched',

just after

Code:
'non_exist_comment' => 'The selected comment does not exist', //cpg1.4

Add

Code:
'confirm' => 'Confirmation',

just after

Code:
'report_comment_title' => 'Report this comment to the administrator', //cpg1.4

##############

Edit themes/yourtheme/theme.php

Add

Code:
'{CONFIRM}' => $lang_display_comments['confirm'],

just after

Code:
'{COMMENT}' => $lang_display_comments['comment'],

Add

Code:
{CONFIRM}  

just after

Code:
   

##################

Edit db_input.php

Add

Code:
require("include/captcha.class.php"); if (!PhpCaptcha::Validate($_POST['confirmCode'])) { cpg_die(ERROR, "Confirmation code didn't matched", __FILE__, __LINE__); }

just after

Code:
case 'comment': if (!(USER_CAN_POST_COMMENTS)) cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);

That’s it. Hope this helps some of you out there….

Leave a Reply