Backend Development

[PHP] Blacklist Checker

Submitted by Gashi, , Thread ID: 22917

Thread Closed
31-08-2016, 04:54 AM
#1
Here are the very first script t simply indicating whether the IP is blacklisted or not


Code:
<html>
  <head>
  <title>Blacklist Check</title>
  </head>
  <body>
<center>
  <form action="" method="get">
  <input type="text" value="" name="ip" />
  <input type="submit" value="LOOKUP" />
  </form>
  <?php
$serverIP = $_SERVER["SERVER_ADDR"];
echo "Server IP is: <b>{$serverIP}</b><br>";
  function dnsbllookup($ip){
  $dnsbl_lookup=array("dnsbl-1.uceprotect.net","dnsbl-2.uceprotect.net","dnsbl-3.uceprotect.net","dnsbl.dronebl.org","dnsbl.sorbs.net","zen.spamhaus.org");
  if($ip){
  $reverse_ip=implode(".",array_reverse(explode(".",$ip)));
  foreach($dnsbl_lookup as $host){
  if(checkdnsrr($reverse_ip.".".$host.".","A")){
  Host: $listed.=$reverse_ip.'<- Reverse Ip | Your Ip -> '.$ip.' <font color="red">Blacklisted!</font><br /><br>';
  }
  }
  }
  if($listed){
  echo $listed;
  }else{
  echo '<br>'.$ip.' <font color="green">Is not blacklisted!</font><br />';
  }
  }
  $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></center>
  </html>

Users browsing this thread: 1 Guest(s)