Message Board

http:BL Use/Development

Older Posts ]   [ Newer Posts ]
 httpbl php function
Author: C.Visser   (7 Jan 09 9:50pm)
Hello :-)

I hope someone finds this function useful..
Tested on php 4.3.1 on a windows system.

<?
/*
Project Honey Pot Http BlackList
http://www.projecthoneypot.org/httpbl_configure.php

version 0.1.1 - php4 function
- 2009-01-05 version 0.1.1 by Colin Visser, OzySoftware.com

version 0.1 - original work was a php5 class -
- 2008-01-18 version 0.1 by Francois Dechery, www.440net.net

This php function is distribured under the GNU Public License ("GPL")
version 2.
http://www.gnu.org/licenses/gpl.txt

--------------
Usage Example:

save the function code as "blacklist.php".
save the example code as "test.php".
dont forget to copy your http_bl KEY to the function/blacklist.php, or it
wont work..

<?php

include("blacklist.php");

// --the result for this ip = search engine--
$test-this-ip="127.1.1.0";

$blr=blacklist($test-this-ip);

echo $blr."<p>";

// or, to get to the individual values..

$results=explode('-',$blr);
$rc=count($results);
$i=1;

while($i < $rc) {
echo "[".$i."] ".$results[$i]."<br>";
$i++;
}

?>

*/

function blacklist($testip){

$access_key ="12.digit.key.goes.here"; // copy your 12 digit http_bl KEY
here <---<<

$domain ="dnsbl.httpbl.org";
$spam_codes=array(
0 =>'Search Engine',
1 =>'Suspicious',
2 =>'Harvester',
3 =>'Suspicious and Harvester',
4 =>'Comment Spammer',
5 =>'Suspicious and Comment Spammer',
6 =>'Harvester and Comment Spammer',
7 =>'Suspicious and Harvester and Comment Spammer');

$search_engine=array(
0 =>'0 No Name',
1 =>'1 No Name',
2 =>'Ask Jeeves/Teoma',
3 =>'Baiduspider',
4 =>'4 No Name',
5 =>'Google Bot',
6 =>'6 No Name',
7 =>'7 No Name',
8 =>'Live/MSN Bot',
9 =>'Yahoo! Slurp',
10 =>'Twiceler');

$data0="$testip-Not Found";
$data1="$testip-Search Engine";
$data2="$testip-Spammer";

$first=0;
$days =0;
$score =0;
$type=0;

// return data1 (Search Engine) or data2 (Spammer) if host is found, else
return data0 (Not Found)

if(!$testip){return FALSE;}

list($a,$b,$c,$d)=explode('.',$testip);

$query="$access_key.$d.$c.$b.$a.$domain";

$host=gethostbyname($query);

list($first,$days,$score,$type)=explode('.',$host);

if($first==127){
//spammer
$data2.="-Days-".$days;
$data2.="-Score-".$score;
$data2.="-Type-".$type;
$data2.="-".$spam_codes[$type];

// search engine
if($type==0){
$data1.="-Days-".$days;
$data1.="-Score-".$score;
$data1.="-Type-".$type;
$data1.="-".$search_engine[$score];

return $data1;
}
else{return $data2;}

return $data0;
}
}
?>



do not follow this link

Privacy Policy | Terms of Use | About Project Honey Pot | FAQ | Cloudflare Site Protection | Contact Us

Copyright © 2004–17, Unspam Technologies, Inc. All rights reserved.

contact | wiki | email