1: <?php
2: /*
3: You may not change or alter any portion of this comment or credits
4: of supporting developers from this source code or any supporting source code
5: which is considered copyrighted (c) material of the original comment or credit authors.
6:
7: This program is distributed in the hope that it will be useful,
8: but WITHOUT ANY WARRANTY; without even the implied warranty of
9: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: */
11:
12: /**
13: * Protector
14: *
15: * @copyright XOOPS Project (http://xoops.org)
16: * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
17: * @package protector
18: * @author trabis <lusopoemas@gmail.com>
19: * @version $Id$
20: */
21:
22: // get your 12-character access key from http://www.projecthoneypot.org/
23: define('PROTECTOR_HTTPBL_KEY', '............');
24:
25: class protector_postcommon_post_deny_by_httpbl extends ProtectorFilterAbstract
26: {
27: function execute()
28: {
29: $xoops = Xoops::getInstance();
30:
31: // http:bl servers (don't enable too many servers)
32: $rbls = array(
33: 'http:BL' => PROTECTOR_HTTPBL_KEY . '.%s.dnsbl.httpbl.org',
34: );
35:
36: $rev_ip = implode('.', array_reverse(explode('.', @$_SERVER['REMOTE_ADDR'])));
37: // test
38: // $rev_ip = '162.142.248.125' ;
39:
40: foreach ($rbls as $rbl_name => $rbl_fmt) {
41: $host = sprintf($rbl_fmt, $rev_ip);
42: if (gethostbyname($host) != $host) {
43: $this->protector->message .= "DENY by $rbl_name\n";
44: $uid = $xoops->isUser() ? $xoops->user->getVar('uid') : 0;
45: $this->protector->output_log('RBL SPAM', $uid, false, 128);
46: die(_MD_PROTECTOR_DENYBYRBL);
47: }
48: }
49: return true;
50: }
51: }
52: