I know this is ugly, and doesnt really use mod_rewrite, but this should do the trick... (just save this as prx_chk.php):
- Code: Select all
<?php
$addr = $_SERVER['REMOTE_ADDR'];
$raddr = explode('.', $addr);
$raddr = $raddr[3].'.'.$raddr[2].'.'.$raddr[1].'.'.$raddr[0];
$ip['opm'] = gethostbyname($raddr.'.opm.blitzed.org');
$ip['njabl'] = gethostbyname($raddr.'.dnsbl.njabl.org');
$ip['akill'] = gethostbyname($raddr.'.dnsbl.winbots.org');
$ip['virbl'] = gethostbyname($raddr.'.virbl.dnsbl.bit.nl');
$ip['ircahbl'] = gethostbyname($raddr.'.ircbl.ahbl.org');
$ip['sectoor'] = gethostbyname($raddr.'.tor.dnsbl.sectoor.de');
$ip['torahbl'] = gethostbyname($raddr.'.tor.ahbl.org');
$ip['no-more-funn'] = gethostbyname($raddr.'.no-more-funn.moensted.dk');
$ip['sorbs'] = gethostbyname($raddr.'.dnsbl.sorbs.net');
if ($ip['opm'] == $raddr.'.opm.blitzed.org') { $ip['opm'] = "...n"; }
if ($ip['njabl'] == $raddr.'.dnsbl.njabl.org') { $ip['njabl'] = "...n"; }
if ($ip['akill'] == $raddr.'.dnsbl.winbots.org') { $ip['akill'] = "...n"; }
if ($ip['virbl'] == $raddr.'.virbl.dnsbl.bit.nl') { $ip['virbl'] = "...n"; }
if ($ip['ircahbl'] == $raddr.'.ircbl.ahbl.org') { $ip['ircahbl'] = "...n"; }
if ($ip['sectoor'] == $raddr.'.tor.dnsbl.sectoor.de') { $ip['sectoor'] = "...n"; }
if ($ip['torahbl'] == $raddr.'.tor.ahbl.org') { $ip['torahbl'] = "...n"; }
if ($ip['no-more-funn'] == $raddr.'.no-more-funn.moensted.dk') { $ip['no-more-funn'] = "...n"; }
if ($ip['sorbs'] == $raddr.'.dnsbl.sorbs.net') { $ip['sorbs'] = "...n"; }
$ip['opm'] = explode('.', $ip['opm']);
$ip['njabl'] = explode('.', $ip['njabl']);
$ip['akill'] = explode('.', $ip['akill']);
$ip['virbl'] = explode('.', $ip['virbl']);
$ip['ircahbl'] = explode('.', $ip['ircahbl']);
$ip['sectoor'] = explode('.', $ip['sectoor']);
$ip['torahbl'] = explode('.', $ip['torahbl']);
$ip['no-more-funn'] = explode('.', $ip['no-more-funn']);
$ip['sorbs'] = explode('.', $ip['sorbs']);
$ip['opm'] = $ip['opm'][3];
$ip['njabl'] = $ip['njabl'][3];
$ip['akill'] = $ip['akill'][3];
$ip['virbl'] = $ip['virbl'][3];
if ($ip['ircahbl'] == 'n') { $ip['ircahbl'] = "You Aren't Listed."; }
if ($ip['sectoor'] == 'n') { $ip['sectoor'] = "You Aren't Listed."; }
if ($ip['torahbl'] == 'n') { $ip['torahbl'] = "You Aren't Listed."; }
if ($ip['no-more-funn'] == 'n') { $ip['no-more-funn'] = "You Aren't Listed."; }
if ($ip['sorbs'] == 'n') { $ip['sorbs'] = "You Aren't Listed."; }
if (($ip['njabl'] != '9') and ($ip['njabl'] != "You Aren't Listed.")) { $ip['njabl'] = "Invalid Reply (You Aren't Listed)"; }
if (($ip['akill'] != '1') and ($ip['akill'] != "You Aren't Listed.")) { $ip['akill'] = "Invalid Reply (You Aren't Listed)"; }
if (($ip['sectoor'] != '1') and ($ip['sectoor'] != "You Aren't Listed.")) { $ip['sectoor'] = "Invalid Reply (You Aren't Listed)"; }
if (($ip['torahbl'] != '2') and ($ip['torahbl'] != "You Aren't Listed.")) { $ip['torahbl'] = "Invalid Reply (You Aren't Listed)"; }
if (($ip['no-more-funn'] != '10') and ($ip['no-more-funn'] != "You Aren't Listed.")) { $ip['no-more-funn'] = "Invalid Reply (You Aren't Listed)"; }
if (($ip['sorbs'] != '2') and ($ip['sorbs'] != '3') and ($ip['sorbs'] != '4') and ($ip['sorbs'] != "You Aren't Listed.")) { $ip['sorbs'] = "Invalid Reply (You Aren't Listed)"; }
if (is_numeric($ip['opm'])) { $listed = 1; }
if (is_numeric($ip['njabl'])) { $listed = 1; }
if (is_numeric($ip['akill'])) { $listed = 1; }
if (is_numeric($ip['virbl'])) { $listed = 1; }
if (is_numeric($ip['ircahbl'])) { $listed = 1; }
if (is_numeric($ip['sectoor'])) { $listed = 1; }
if (is_numeric($ip['torahbl'])) { $listed = 1; }
if (is_numeric($ip['no-more-funn'])) { $listed = 1; }
if (is_numeric($ip['sorbs'])) { $listed = 1; }
if ($listed == 1) { die("Your ip, ".$addr.", is listed in one or more of the proxy/abusive lists we check."); }
?>
then in your existing php pages, at the top right after "<?php", put:
- Code: Select all
include("/path/to/your/prx_chk.php");
NOTE: this will slow down your pages loading time... and will use more bandwidth