XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
postcommon_post_deny_by_httpbl.php
Go to the documentation of this file.
1 <?php
2 
3 // get your 12-character access key from http://www.projecthoneypot.org/
4 define('PROTECTOR_HTTPBL_KEY' , '............' ) ;
5 
7 
8  function execute()
9  {
10  // http:bl servers (don't enable too many servers)
11  $rbls = array(
12  'http:BL' => PROTECTOR_HTTPBL_KEY.'.%s.dnsbl.httpbl.org' ,
13  ) ;
14 
15  global $xoopsUser ;
16 
17  $rev_ip = implode( '.' , array_reverse( explode( '.' , @$_SERVER['REMOTE_ADDR'] ) ) ) ;
18  // test
19  // $rev_ip = '162.142.248.125' ;
20 
21  foreach( $rbls as $rbl_name => $rbl_fmt ) {
22  $host = sprintf( $rbl_fmt , $rev_ip ) ;
23  if( gethostbyname( $host ) != $host ) {
24  $this->protector->message .= "DENY by $rbl_name\n" ;
25  $uid = is_object( $xoopsUser ) ? $xoopsUser->getVar('uid') : 0 ;
26  $this->protector->output_log( 'RBL SPAM' , $uid , false , 128 ) ;
28  }
29  }
30 
31  return true ;
32  }
33 
34 }
35 
36 ?>