Home arrow How to use arrow Gallery 2.x
Gallery 2.x Print E-mail
How to protect Gallery2 against spammers using spamtrap.org.ua.
Despite the fact that Gallery2 already has quite good protection from spam, this script in general is heavy load. So I suggest use Spamtrap to reduce load.
  1. Download latest version spamtrap library for PHP, unpack and put spamtrap.php into main dir of gallery. This directory usually contain bootstrap.inc, config.php, main.php.
  2. If here exist index.php - ok, that file we need. If no - choose bootstrap.inc.
  3. Make a backup.
  4. Open selected file in any plain text editor, for example Notepad. Word isn't suitable.
  5. On second line just after "<?php" paste the code:
    //spamtrap.org.ua start
    define("SPAMTRAP", "/full/path/to/spamtrap.php");  
    
    // spamtrap_karma - it is threshold - how much "dirty" users can visit 
    // your site. You free to change this constant, so the higher value is, 
    // the more bots you accept.
    // It's strongly recommended to use value greater than 3.
    $spamtrap_karma = 4;
    
    if (is_readable(SPAMTRAP)) include(SPAMTRAP);  
    
    $response = spamtrap($_SERVER["REMOTE_ADDR"]);
    
    //For debug purpose
    //echo "<h1>$response (".$_SERVER["REMOTE_ADDR"].")</h1>"; 
    
    if ($response>$spamtrap_karma) {	
    	echo "Spambots are not alloved to visit";
    	exit;
    }
    //spamtrap.org.ua end
    
  6. How to check: Uncomment debug line and visit your site. "Clean" IP has 0 value of "karma". Responce value "-1" mean error.
Last Updated ( Thursday, 07 June 2007 )
 
< Prev   Next >