. // // Alexey A.Znayev, znaeff@mail.ru, http://xbsoft.org, http://xbsoft.ru // /////////////////////////////////////////////////////////////////////////// // This file contains public class DNSBL // This class performs IP address check in spam blocking lists as described // on http://ru.wikipedia.org/wiki/RBL class DNSBL { private $_aCheckers = array( // list of checkers available for individual checking 'spamhaus' => array('.zen.spamhaus.org', true), //available for group checking with 'all' key 'spamcop' => array('.bl.spamcop.net', true), //available for group checking with 'all' key 'dsbl' => array('.list.dsbl.org', false), //not available for group checking with 'all' key 'ordb' => array('.relays.ordb.org', false), //not available for group checking with 'all' key 'sorbs' => array('.dnsbl.sorbs.net', false), //not available for group checking with 'all' key 'njabl' => array('.dnsbl.njabl.org', false) //not available for group checking with 'all' key ); // AZ - 1. Key 'all' is illegal // AZ - 2. Most of spammer IP addresses is covered by 'spamhaus' & 'spamcop' (and they are fast), // some of the rest may not work sometimes, you can make them group checking available after individual testing private $_sDefaultChecker = 'spamhaus'; /////////////////////////////////////////////////////////////////////////// // CheckSpamIP - check IP for spam in checkers : given, default or all available for group checking (may be slow) // parameters: // string $ip - ip address // string $checker - checker name or 'all' or nothing // returns: // true when IP exitsts in spam-lists of $checker or at least one of all checkers // false when not or when ip address is local or not correct public function CheckSpamIP($ip, $checker = ''){ if(empty($ip)) return false; if(preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $ip) != 1) return false; $octets = explode('.', $ip); if($octets[0] == '127') return false; if($octets[0] == '10') return false; if($octets[0] == '192' && $octets[0] == '168') return false; if($octets[0] == '169' && $octets[0] == '254') return false; // ms windows if((int)$octets[0] > 255 || (int)$octets[1] > 255 || (int)$octets[2] > 255 || (int)$octets[3] > 255 ) return false; $ret_val = false; $PTR = implode(array_reverse($octets), '.'); if($checker === 'all'){ foreach(array_values($this->_aCheckers) as $c){ if($c[1]){ $ret_val = $ret_val || $this->_CheckDNSAnswer(dns_get_record($PTR . $c[0], DNS_A)); } if($ret_val) break; } }else if(array_key_exists($checker, $this->_aCheckers)){ $ret_val = $this->_CheckDNSAnswer(dns_get_record($PTR . $this->_aCheckers[$checker][0], DNS_A)); }else{ $ret_val = $this->_CheckDNSAnswer(dns_get_record($PTR . $this->_aCheckers[$this->_sDefaultChecker][0], DNS_A)); } return $ret_val; } /////////////////////////////////////////////////////////////////////////// // GetCheckers - gets list of available checker names // returns: // array of strings public function GetCheckers(){ return array_keys($this->_aCheckers); } /////////////////////////////////////////////////////////////////////////// // GetGroupCheckers - gets list of checker names available for group checking with 'all' key // returns: // array of strings public function GetGroupCheckers(){ $ret_val = array(); foreach(array_keys($this->_aCheckers) as $k) if($this->_aCheckers[$k][1]) array_push($ret_val, $k); return $ret_val; } /////////////////////////////////////////////////////////////////////////// // GetDefaultChecker - gets default checker name // returns: // string public function GetDefaultChecker(){ return $this->_sDefaultChecker; } /////////////////////////////////////////////////////////////////////////// // SetDefaultChecker - sets default checker name // parameters: // string $new_checker - new default checker name // returns: // true when success // false when failed ($new_checker is not in the list of available checker names) public function SetDefaultChecker($new_checker){ if(array_key_exists($new_checker, $this->_aCheckers)){ $this->_sDefaultChecker = $new_checker; return true; }else{ return false; } } /////////////////////////////////////////////////////////////////////////// // EnableGroupChecking - sets checker available for group checking // parameters: // string $checker - checker name // returns: // true when success ($checker is included) // false when failed ($checker is not in the list of available checker names) public function EnableGroupChecking($checker){ if(array_key_exists($checker, $this->_aCheckers)){ $this->_aCheckers[$checker][1] = true; return true; }else{ return false; } } /////////////////////////////////////////////////////////////////////////// // DisableGroupChecking - sets checker not available for group checking // parameters: // string $checker - checker name // returns: // true when success ($checker is excluded) // false when failed ($checker is not in the list of available checker names) public function DisableGroupChecking($checker){ if(array_key_exists($checker, $this->_aCheckers)){ $this->_aCheckers[$checker][1] = false; return true; }else{ return false; } } // private methods /////////////////////////////////////////////////////////////////////////// // _CheckDNSAnswer - checks DNS-server answer for 127.0.0.* values // returns: // true when success // false when failed private function _CheckDNSAnswer($dns_answer){ if(!is_array($dns_answer)) return false; $len = count($dns_answer); if($len <= 0) return false; for($i=0; $i<$len; $i++){ $obj = $dns_answer[$i]; if(!(is_object($obj) || is_array($obj))) return false; $ip_str = $obj['ip']; if(!is_string($ip_str)) return false; $pos = strpos($ip_str, '127.0.0.'); if($pos !== false) return true; } return false; } } // end of class DNSBL ?> Comentarios en Run Mireya Run !!! https://runmireyarun.com Una viejita con coraje para correr. Tue, 01 Apr 2014 14:51:52 +0000 hourly 1 https://wordpress.org/?v=6.9.4 Comentario en CARRERAS por Jaime Pinilla https://runmireyarun.com/carreras/#comment-206 Tue, 01 Apr 2014 14:51:52 +0000 http://runmireyarun.com/?page_id=3220#comment-206 Hola Mireya, muy bueno tu blog,
Te felicito.

]]>
Comentario en RECIBIENDO MI CAMISETA. por paola https://runmireyarun.com/carreras/carreras-2013/media-maraton-de-bogota-julio-28-de-2013/dsc05706-2/#comment-197 Sun, 28 Jul 2013 00:01:14 +0000 http://runmireyarun.com/wp-content/uploads/2013/07/DSC057061.jpg#comment-197 Mami, y esa chaqueta negra?

]]>
Comentario en DSCN0210 por jorge oviedo https://runmireyarun.com/lugar-de-entrenamiento-2/dscn0210-2/#comment-196 Sat, 27 Jul 2013 17:20:59 +0000 http://runmireyarun.com/wp-content/uploads/2012/10/DSCN02101.jpg#comment-196 Hola…me gustan todas las fotos, pero ésta me fascina.

]]>
Comentario en Puente peatonal, al fondo darán inicio a la maratón. por Maria E https://runmireyarun.com/run-tour-avianca-2013/dsc05236/#comment-194 Sun, 07 Apr 2013 03:23:47 +0000 http://runmireyarun.com/wp-content/uploads/2013/03/DSC05236.jpg#comment-194 Derrochando tu elegancia y porte atlético. Muy bonito el uniforme, ademas de la bufanda. Un abrazo.

]]>
Comentario en La Carrera de Empresas 5K – 03 de Junio 2012 por Mireya https://runmireyarun.com/carreras/carreras-2012/la-carrera-de-empresas-5k-junio-2012/#comment-191 Tue, 02 Apr 2013 11:57:49 +0000 http://runmireyarun.com/?page_id=1981#comment-191 En respuesta a escort en dubai.

Gracias mi amigo, te deseo lo mejor para ti siempre.

Lindo día para ti y tu familia.

]]>
Comentario en Camisetas y Medallas por Mireya https://runmireyarun.com/camisetas-y-medallas/#comment-145 Sat, 08 Dec 2012 05:32:13 +0000 http://runmireyarun.com/?page_id=2473#comment-145 En respuesta a Lucia Teresa Jaramillo.

Gracias Teresita, como va todo en tu vida, espero no termine el año sin saludarte personalmente. Feliz día de las velitas. Besoooos

]]>
Comentario en Camisetas y Medallas por Lucia Teresa Jaramillo https://runmireyarun.com/camisetas-y-medallas/#comment-144 Tue, 04 Dec 2012 01:27:36 +0000 http://runmireyarun.com/?page_id=2473#comment-144 Hola Mireya

Que chevere tu blog. Se ve tu empeño y dedicación en lo que haces, te felicito.
Abrazos TERE

]]>
Comentario en LUGAR DE ENTRENAMIENTO por JAVIER REYES https://runmireyarun.com/lugar-de-entrenamiento-2/#comment-143 Wed, 28 Nov 2012 18:46:53 +0000 http://runmireyarun.com/?p=2052#comment-143 En respuesta a Mireya.

Hola Mireya, gracias por lo de veloz, aunque en realidad es que andamos persiguiendo a la esperanza (de un mañana mejor).

Por cierto gracias por mostrar tantos rostros de satisfacción en tus fotos.

]]>
Comentario en DSC04928 por Mireya https://runmireyarun.com/carreras/carreras-2012/carrera-unicef-10-k-18-de-noviembre-2012/dsc04928/#comment-142 Tue, 27 Nov 2012 05:07:17 +0000 http://runmireyarun.com/wp-content/uploads/2012/11/DSC04928.jpg#comment-142 En respuesta a Fred James.

Fred, gracias mi amigo….sé que también eres amante del deporte y de mi parte muchas felicitaciones. Espero sigas
haciendo esos tures al mar y en buena compañía. Bendiciones mi amigo.

]]>
Comentario en Carrera Unicef 10K – 18 de Noviembre- 2012 por Mireya https://runmireyarun.com/carreras/carreras-2012/carrera-unicef-10-k-18-de-noviembre-2012/#comment-141 Tue, 27 Nov 2012 05:05:44 +0000 http://runmireyarun.com/?page_id=2927#comment-141 En respuesta a ali.

I was very happy to see your comment, my friend from Iran. Blessings to you and your beautiful family.

Me dio mucha alegría ver tu comentario, gracias mi amigo de Irán. Bendiciones a ti y tu linda familia.

]]>