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>

RE: [PHP] Blacklist Checker

#2
in few words you are
genius

RE: [PHP] Blacklist Checker

#3
Rather elegant solution. i am surprised i did not came to that myself.

RE: [PHP] Blacklist Checker

#4
I recommend never using this as a major security feature to your site.
Honest;y, this sucks and only protects you from 4-5 DNS's

RE: [PHP] Blacklist Checker

#5
It's much better to use .htaccess Smile

Users browsing this thread: 2 Guest(s)