Created
April 3, 2013 01:00
-
-
Save javierwilson/5297625 to your computer and use it in GitHub Desktop.
looks up an ip address in a DNSBL zone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$zone = 'dnsbl.example.com'; | |
if (isset($_REQUEST['ip'])) { | |
$ip = preg_replace('/[^0-9.]/', '', $_REQUEST['ip']); | |
if(filter_var($ip, FILTER_VALIDATE_IP)) { | |
$fields = explode('.', $ip); | |
$fields = array_reverse($fields); | |
$reverse_ip = implode('.', $fields); | |
$record = $reverse_ip . '.' . $zone; | |
$result = dns_get_record($record, DNS_A); | |
} else { | |
} | |
} | |
?> | |
<html> | |
<head></head> | |
<body> | |
<pre> | |
<?php if (isset($result) && !empty($result)) { | |
echo "<font color=red>$ip listed!</font>"; | |
} elseif (isset($ip)) { | |
echo "$ip not listed."; | |
} ?> | |
</pre> | |
<form> | |
IP address: <input type="text" name="ip" value="<?=$ip?>"/> | |
<input type="submit"/> | |
</form> | |
<small> | |
Contact: syadmin at example dot net | |
</small> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment