Backend Development

[PHP] Blacklist Checker

Submitted by Gashi, , Thread ID: 22917

Thread Closed
Gashi
Novice
Level:
0
Reputation:
-22
Posts:
31
Likes:
2
Credits:
73
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

Madara9987
Newbie
Level:
0
Reputation:
0
Posts:
16
Likes:
1
Credits:
0
10-02-2017, 10:11 PM
#2
in few words you are
genius

RE: [PHP] Blacklist Checker

gregpolson
Lurker
Level:
0
Reputation:
0
Posts:
2
Likes:
0
Credits:
2
04-03-2017, 10:29 AM
#3
Rather elegant solution. i am surprised i did not came to that myself.

RE: [PHP] Blacklist Checker

AbouRass
Newbie
Level:
0
Reputation:
0
Posts:
19
Likes:
0
Credits:
4
23-03-2017, 03:35 AM
#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

plkill
Closed Account
Level:
0
Reputation:
0
Posts:
7
Likes:
0
Credits:
0
27-03-2017, 07:35 PM
#5
It's much better to use .htaccess Smile

Users browsing this thread: 1 Guest(s)