note 53953 added to function.checkdnsrr
| From: | Plasma at osu1 dot php dot net | Date: | Sat, 18 Jun 2005 08:43:13 +0000 |
| Subject: | note 53953 added to function.checkdnsrr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90617@lists.php.net to get a copy of this message | ||
In response to fox dot 69 at gmx dot net's dnsbl function:
<?php
function is_blacklisted($ip) {
$dnsbl_check=array("bl.spamcop.net",
"relays.osirusoft.com",
"list.dsbl.org",
"sbl.spamhaus.org");
if ($ip) {
$quads=explode(".",$ip);
$rip=$quads[3].".".$quads[2].".".$quads[1].".".$quads[0];
for ($i=0; $i<count($dnsbl_check); $i++) {
if (checkdnsrr($rip.".".$dnsbl_check[$i] . '.',"A")) {
$listed.=$dnsbl_check[$i]." ";
}
}
if ($listed) { return $listed; } else { return FALSE; }
}
}
?>
Add a . after the $dnsbl_check[$i] so that it returns a valid response, I found this was not working
(always returned the A record) when I didnt specify the . at the end:
if (checkdnsrr($rip.".".$dnsbl_check[$i] . '.',"A")) {
----
Manual Page -- http://www.php.net/manual/en/function.checkdnsrr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53953
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53953&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53953&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53953&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53953&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+53953&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53953&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53953&report=yes
Search -- http://master.php.net/manage/user-notes.php