source: spip-zone/_plugins_/captcha2/rbl.php @ 84314

Last change on this file since 84314 was 25972, checked in by erational@…, 11 years ago

integration de RBL (Realtime Blackhole List).merci Fil

File size: 739 bytes
Line 
1<?php
2
3// Verifier les POST contre une blacklist publique
4if ($_SERVER['REQUEST_METHOD'] === 'POST') {
5
6        $lookup = implode('.', array_reverse(explode('.', $GLOBALS['ip']))) . '.'
7                . ((isset($GLOBALS['meta']['rbl'])
8                AND is_array($conf = @unserialize($GLOBALS['meta']['rbl']))
9                AND strlen($conf['rbl']))
10                        ? $conf['rbl']
11                        : 'httpbl.abuse.ch'
12                );
13        if (preg_match(',^127\.0\.0\.[234]$,', gethostbyname($lookup))) {
14                spip_log('rbl blocked: '.$GLOBALS['ip'].' response: '.gethostbyname($lookup), 'rbl');
15                header('HTTP/1.1 403 Forbidden');
16                die ("<html> <head> <title>403 Forbidden</ title> </head>
17                <body> <h1>403 Forbidden</h1>
18                <p>".$GLOBALS['ip']." is listed in RBL (". gethostbyname($lookup) .").</p> </body> </html>");
19        }
20}
21
22?>
Note: See TracBrowser for help on using the repository browser.