Author |
Message |
Guardian2003
Site Admin

Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Fri Apr 27, 2007 3:24 am |
|
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;
}
}
}
|
|
|
|
|
 |
kguske
Site Admin

Joined: Jun 04, 2004
Posts: 6437
|
Posted:
Fri Apr 27, 2007 11:19 am |
|
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! |
|
|
 |
Guardian2003

|
Posted:
Fri Apr 27, 2007 1:41 pm |
|
Thanks I'll check it out!! |
|
|
|
 |
evaders99
Former Moderator in Good Standing

Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Sat Apr 28, 2007 11:04 pm |
|
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! |
|
|
 |
Guardian2003

|
Posted:
Mon Apr 30, 2007 2:36 pm |
|
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
|
Posted:
Mon Apr 30, 2007 5:55 pm |
|
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! |
|
|
 |
|