Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Fri Apr 27, 2007 3:24 am Reply with quote

I have a code snippet that makes use of one of PHP 5's built in functions
(dns_get_record) does anyone know of an equivelant for PHP 4.4.x or recommend a suitable change to the code below?

Code:


define('KEY', '12345678');
define('REQFORMAT', '%s.%s.dnsbl.httpbl.org');
define('NOTIFYEMAIL', 'me@mymail.com');

$remoteIP = $_SERVER['REMOTE_ADDR'];

$remoteData = explode('.', $remoteIP);
$reverseData = array_reverse($remoteData);
$reverseIP = implode('.', $reverseData);

$lookup = dns_get_record(sprintf(REQFORMAT, KEY, $reverseIP), DNS_A);

if (count($lookup) > 0) {
  // Something is up
  $data = current($lookup);
  $info = explode('.', $data['ip']);

  $requestCode = $info[0];
  $lastActivity = $info[1];
  $threatScore = $info[2];
  $visitorType = $info[3];

  // http://www.projecthoneypot.org/httpbl_api.php
  // If not 127 an error may have occurred - so we can't block
  if ($requestCode == '127') {
    if ($visitorType >= 2) {
      $refURL = 'http://www.projecthoneypot.org';
      echo 'Access Denined To Content: See: <a href="' . $refURL . '">' . $refURL . '</a>';
      mail(NOTIFYEMAIL, 'Access Blocked Via HoneyPot: ' . $remoteIP, '');
      exit;
    }

  }
}
 
View user's profile Send private message Send e-mail
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6437

PostPosted: Fri Apr 27, 2007 11:19 am Reply with quote

Did you try Only registered users can see links on this board! Get registered or login!?

_________________
I search, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
Guardian2003







PostPosted: Fri Apr 27, 2007 1:41 pm Reply with quote

Thanks I'll check it out!!
 
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Sat Apr 28, 2007 11:04 pm Reply with quote

Seems like its PHP extension, it requires to be compiled into PHP. At that rate, you may just want to upgrade PHP

Thanxs for the ProjectHoneypot link though, I want to check this out and see how it works

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Guardian2003







PostPosted: Mon Apr 30, 2007 2:36 pm Reply with quote

If you sign up and install a honeypot or two you'll get access to their http:BL list.
As this list is verified it's a better proposition for auto-banning than the likes of Spamhuas etc.
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Mon Apr 30, 2007 5:55 pm Reply with quote

Quote:

you may just want to upgrade PHP


You know what, you may just want to do that, of course, on a local XAMPP install first testing the crap out of your add-ons. Usually slight adjustments can be made to the classes and/or sql calls to run on the higher versions of PHP and mySQL. It is just so worth it I think. I think we need to start pushing people in that direction rather than staying behind on old stodgy releases... It will take a groundswell of customer requests to finally get host moving in that direction as well.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©