Plugin Directory

Changeset 185118


Ignore:
Timestamp:
12/20/2009 12:39:00 AM (16 years ago)
Author:
ljmacphee
Message:

redirect bots to main page instead of error page

Location:
ttc-user-registration-bot-detector/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ttc-user-registration-bot-detector/trunk/readme.txt

    r185105 r185118  
    44Requires at least: 2.5
    55Tested up to: 2.5.1
    6 Stable tag: 1.9
     6Stable tag: 1.10
    77
    88This plugin blocks and logs most bot user registrations.
  • ttc-user-registration-bot-detector/trunk/ttc_user_registration.php

    r185105 r185118  
    33/*
    44Plugin Name: TimesToCome Stop Bot Registration
    5 Version: 1.9
     5Version: 1.10
    66Plugin URI:  http://herselfswebtools.com/2008/06/wordpress-plugin-to-prevent-bot-registrations.html
    77Description: Stop bots from registering as users
     
    1111
    1212
     13   
     14// version 1.9 is a security fix
     15// ******************************************************************************************   
     16// version 2.0 sends rejected bots back to main site page
     17//         if you'd rather send them to a custom error page as before uncomment the custom error page
     18    //         and comment out  // send rejections back to main site page
     19    //$host  = $_SERVER['HTTP_HOST'];
     20    //$uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
     21    //header("Location: http://$host$uri");
     22//          which is in here twice starting around line 265
     23// ******************************************************************************************* 
     24   
    1325   
    1426       
     
    246258           
    247259       
    248             /*
    249             // most hosting companies don't allow file_get_contents - need alternative!
    250             // but if you can use it, do so.
    251             // check forumspam
    252             if ( $blacklisted == 0 ){
    253                 $check = file_get_contents ( "http://www.stopforumspam.com/api?email=$new_user" );
    254                 $test = "<appears>yes</appears>";
    255            
    256                 if ( strpos( $check, $test) > 0 ) {
    257                     $blacklisted = 13;
    258                 }
    259             }
    260             */
    261 
    262 
    263     /*      // uncomment this if you wish to check the spamhaus blacklist.
    264             // check spamhaus
    265             if ( $blacklisted == 0 ){
    266                 $spam_haus  = 'zen.spamhaus.org';
    267 
    268                 // valid query format is: ][reversed ip].zen.spamhaus.org
    269 
    270                 $reverse_ip = array_reverse(explode('.', $http_remote_addr));
    271                 $lookup = implode('.', $reverse_ip) . '.' . $spam_haus;
    272 
    273        
    274                 if ($lookup == "127.0.0.2" ){ // direct ube sources, verified spam services and rokso spammers
    275                     $blacklisted = 14;
    276                 }else if (( $lookup == "127.0.0.4" )||( $lookup == "127.0.0.5" ) || ( $lookup == "127.0.0.6" )){ // 3rd party exploits
    277                     $blacklisted = 15;
    278                 }
    279             }
    280     */
    281 
    282        
    283260       
    284261       
     
    296273                ttc_add_to_log(  $new_user, $blacklisted );
    297274               
     275               
     276                // send rejections back to main site page
     277                $host  = $_SERVER['HTTP_HOST'];
     278                $uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
     279                header("Location: http://$host$uri");
     280               
     281               
     282                // or print a custom error page if you prefer
     283                /*
    298284                // print error page
    299285                print "<html>\n";
     
    303289                print "</body>\n";
    304290                print "</html>\n";
    305            
     291                 */
    306292                exit();
    307293
     
    315301                ttc_add_to_ip_blacklist( $http_remote_addr );
    316302           
     303                // send rejections back to main site page
     304                $host  = $_SERVER['HTTP_HOST'];
     305                $uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
     306                header("Location: http://$host$uri");
     307               
     308                // or send a custom error page if you prefer
     309                /*
    317310                //print  error page
    318311                print "<html>\n";
     
    322315                print "</body>\n";
    323316                print "</html>\n";
    324            
     317                 */
     318                 
     319                 
    325320                exit();
    326321
Note: See TracChangeset for help on using the changeset viewer.