Home arrow How to use arrow Wordpress 2.x without using plugins
Wordpress 2.x without using plugins Print E-mail
How to use spamtrap.org.ua with your WordPress.
This method can make your blog's life (and you, of course) easier without using plugins.
Advantages: Spam-bot can be rejected before blog engine load, before database connecting, plugins loading, etc. ahead of almost all. Result is significant reducing CPU and network load with comparison "plugin method".
Disadvantages: You must edit one wordpress file.
  1. Download latest version spamtrap library for PHP, unpack and put spamtrap.php into main dir of wordpress. This directory usually contain wp-config.php, wp-cron.php, wp-feed.php.
  2. Let's find wp-config.php in main wordpress directory.
  3. Make a backup.
  4. Open wp-config.php in any plain text editor, for example Notepad. Word isn't suitable.
    The begin of file look like this:
    <?php
    // ** MySQL settings ** //
    define('DB_NAME', 'db');    // The name of the database
    define('DB_USER', 'user');     // Your MySQL username
    define('DB_PASSWORD', 'pass'); // ...and password
    define('DB_HOST', 'localhost'); // you won't need to change
    
  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 ( Saturday, 16 June 2007 )
 
< Prev   Next >