HTML;
$ip=$_SERVER['REMOTE_ADDR'];
$days = $_SESSION['httpbl']['activity'];
if (httpbl_lang()=='fr')
{
$daysmsg=($days>1?" il y a $days jours":'');
echo <<
! |
Votre adresse IP a été détectée comme émettant du spam$daysmsg. Il est possible que votre ordinateur soit infecté.
Merci de vous en assurer en utilisant un de ces antivirus gratuits: Microsoft Safety Scanner,
HouseCall TrendMicro ou Malwarebytes AntiMalware. |
Ce message s'affiche car ce site web participe à Project Honeypot pour la lutte contre le spam. |
Ce message continuera à s'afficher plusieurs jours après une éventuelle désinfection de votre ordinateur. |
HTML;
}
else
{
$daysmsg=($days>1?" $days days ago":'');
echo <<
HTML;
}
}
function httpbl_check() {
$ip = $_SERVER['REMOTE_ADDR'];
// build the lookup DNS query
// Example : for '127.9.1.2' you should query 'abcdefghijkl.2.1.9.127.dnsbl.httpbl.org'
$lookup = HTTPBL_API_KEY . '.' . implode('.', array_reverse(explode ('.', $ip ))) . '.dnsbl.httpbl.org';
// check query response
$result = explode( '.', gethostbyname($lookup));
if ($result[0] == 127)
{
// Query successful !
$a = array('activity'=>$result[1], 'threat'=>$result[2], 'type'=>$result[3]);
$typemeaning='';
if ($a['type'] & 0) $typemeaning .= 'Search Engine, ';
if ($a['type'] & 1) $typemeaning .= 'Suspicious, ';
if ($a['type'] & 2) $typemeaning .= 'Harvester, ';
if ($a['type'] & 4) $typemeaning .= 'Comment Spammer, ';
$a['typemeaning'] = trim($typemeaning,', ');
// Now determine some blocking policy
$a['block']=0;
if (
($a['type'] >= 4 && $a['threat'] > 0) // Comment spammer with any threat level
||
($a['type'] < 4 && $a['threat'] > 20) // Other types, with threat level greater than 20
)
{
$a['block'] = 1;
}
$_SESSION['httpbl']=$a;
if ($a['block']!=0) {
httpbl_logme();
httpbl_blockme();
exit();
}
}
}
function httpbl_logme() {
$log = fopen($_SERVER["DOCUMENT_ROOT"].'/httpbl.txt','a');
$stamp = date('Y-m-d :: H-i-s');
$page = $_SERVER['REQUEST_URI'];
$ua = $_SERVER["HTTP_USER_AGENT"];
if (!isset($_COOKIE['notabot'])) {
fputs($log,"$stamp :: BLOCKED ".$_SERVER['REMOTE_ADDR']." :: ".$_SESSION['httpbl']['type']." :: ".$_SESSION['httpbl']['threat']." :: ".$_SESSION['httpbl']['activity']." :: $page :: $ua\n");
} else {
fputs($log,"$stamp :: UNBLCKD ".$_SERVER['REMOTE_ADDR']." :: $page :: $ua\n");
}
fclose($log);
}
function httpbl_blockme() {
header('HTTP/1.0 403 Forbidden');
echo '';
httpbl_infected();
echo <<
function setcookie( name, value, expires, path, domain, secure ) {
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );
if ( expires ) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
function letmein() {
setcookie('notabot','true',1,'/', '', '');
location.reload(true);
}
HTML;
if (httpbl_lang()=='fr')
{ echo 'Pour continuer la navigation, merci de cliquer sur
ce lien. Désolé du dérangement.
'; }
else
{ echo 'Please click
this link to continue. Sorry for the inconvenience.
'; }
echo '';
}
?>