Author: D.Clerici (7 Feb 08 7:20pm)
If you already got a key there are mods to automatically send known spammers IP to your quicklink page (or wherever you want), but I found quicker and easier this piece of code:
http://fellowship-hall.com/viewtopic.php?f=83&t=4121
However I changed it a bit for my own site: I added this lines :
//Referrers Mod Start
// http:BL
require($phpbb_root_path . 'httpBL.'.$phpEx);
to common.php and created the httpBL.php as follow:
(note that I've cut out the "$age_thres" variable.)
httpBL.php (replace "xxxxxx" with your own data and change the options with yours) :
<?php
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
}
function httpbl_check_referer() {
global $_SERVER;
$key = 'xxxxxxxxxxxx';
$result = explode( ".", gethostbyname( $key . "." . implode ( ".", array_reverse( explode( ".", $_SERVER["REMOTE_ADDR"] ) ) ) . ".dnsbl.httpbl.org" ) );
if ( $result[0] == 127 ) {
// Information for the following three configuration variables can be found at
// http://www.projecthoneypot.org/httpbl_api.php
//
// Consider malicious bots with a threat score greater than what (0-255)?
$threat_thres = '1';
// Consider malicious which types of bots?
$denied = '1,2,3,4,5,6,7';
// Where do you want to redirect malicious bots? It is recommended that you
// forward them to a Project Honey Pot QuickLink, available here:
// http://www.projecthoneypot.org/manage_quicklink.php
//
// Alternatively, you may leave the default value or blank the value to not use
// redirection at all, like this:
// $hp = ''
$hp = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$threat = false;
$deny = false;
if ( $result[2] > $threat_thres ) {
$threat = true;
}
foreach ( explode( ",", $denied ) as $value ) {
if ( $value == $result[3] ) {
$deny = true;
}
}
if ( $deny && $threat ) {
if ( $hp ) {
header( "HTTP/1.1 301 Moved Permanently ");
header( "Location: $hp" );
exit;
}
else exit;
}
}
}
httpbl_check_referer();
?>
Post Edited (7 Feb 08 7:24pm)
|