1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

IP Blacklist Check Script

Discussion in 'PHP & Perl' started by dnsbl, Apr 24, 2012.

  1. dnsbl

    dnsbl Newbie

    Joined:
    Mar 25, 2012
    Messages:
    2
    Likes Received:
    0
    Home Page:
    PHP:
    <html> 
    <head> 
    <title>DNSBL Lookup Tool - IP Blacklist Check Script</title> 
    </head> 
    <body> 
    <form action="" method="get"> 
    <input type="text" value="" name="ip" /> 
    <input type="submit" value="LOOKUP" /> 
    </form> 
    <?php 
    /*************************************************************************************** 
    This is a simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once. 

    You are free to use the script, modify it, and/or redistribute the files as you wish. 

    ****************************************************************************************/ 
    function dnsbllookup($ip){ 
    $dnsbl_lookup=array("separated by commas"); // Add your preferred list of DNSBL's 
    if($ip){ 
    $reverse_ip=implode(".",array_reverse(explode(".",$ip))); 
    foreach(
    $dnsbl_lookup as $host){ 
    if(
    checkdnsrr($reverse_ip.".".$host.".","A")){ 
    $listed.=$reverse_ip.'.'.$host.' <font color="red">Listed</font><br />'



    if(
    $listed){ 
    echo 
    $listed
    }else{ 
    echo 
    '"A" record was not found'


    $ip=$_GET['ip']; 
    if(isset(
    $_GET['ip']) && $_GET['ip']!=null){ 
    if(
    filter_var($ip,FILTER_VALIDATE_IP)){ 
    echo 
    dnsbllookup($ip); 
    }else{ 
    echo 
    "Please enter a valid IP"


    ?>  
    </body> 
    </html>

    Under normal circumstances, if you never send any unsolicited bulk email to anyone or you have not participated in any form of spam campaign, this tool need not be used.