Author Topic: needs some help please  (Read 291 times)

seshperankh

  • New Member
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
needs some help please
« on: June 30, 2010, 12:38:30 AM »
Hi
A friend wrote this code for me several years ago.
What it does it go to a database and compares the incomming IP to a database I update by hand.
its used to be part of a page called hate.php and I simply added a require line to load it at the top of the index.php.   Now, it doesnt seem to be working..  Can anyone help me figure out why?
 
 
Quote
<?php
  mysql_connect('localhost', 'USER', 'PASSWORD'); // Change user and pass to your mysql username and password
  mysql_query("use stryfe_blacklist"); // This selects the database
  $BLRangeResult=mysql_query("select * from BlackList"); // Get data from the BlackList table
  while($BLRangeData=mysql_fetch_assoc($BLRangeResult))
   {
    $BLData=explode('.', $BLRangeData['IP']);
    $CIPData=explode('.', $_SERVER['REMOTE_ADDR']);
    if($BLData[0]==$CIPData[0])
     {
   if($BLData[1]=='*' || $BLData[1]==$CIPData[1])
       {
        if($BLData[2]=='*' || $BLData[2]==$CIPData[2])
         {
          if($BLData[3]=='*' || $BLData[3]==$CIPData[3])
     {
      echo '<a href="badspammer.php">' . $lang[perhaps_you_were_looking_something_else] . '</a>'; 
            exit;
           }
         }
       }
     }
   }
?>