cvs: phpweb /include ip-to-country.inc

From: Date: Fri, 02 Feb 2007 14:35:05 +0000
Subject: cvs: phpweb /include ip-to-country.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-34030@lists.php.net to get a copy of this message
nlopess Fri Feb 2 14:35:05 2007 UTC Modified files: /phpweb/include ip-to-country.inc Log: fix #40301: regex didnt ignore some local IPs. also convert ereg to preg_match http://cvs.php.net/viewvc.cgi/phpweb/include/ip-to-country.inc?r1=1.21&r2=1.22&diff_format=u Index: phpweb/include/ip-to-country.inc diff -u phpweb/include/ip-to-country.inc:1.21 phpweb/include/ip-to-country.inc:1.22 --- phpweb/include/ip-to-country.inc:1.21 Mon Oct 11 13:58:43 2004 +++ phpweb/include/ip-to-country.inc Fri Feb 2 14:35:05 2007 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: ip-to-country.inc,v 1.21 2004/10/11 13:58:43 goba Exp $ +// $Id: ip-to-country.inc,v 1.22 2007/02/02 14:35:05 nlopess Exp $ /* @@ -205,9 +205,8 @@ for ($i = 0; $i < count($ips); $i++) { // Skip RFC 1918 IP's 10.0.0.0/8, 172.16.0.0/12 and - // 192.168.0.0/16 -- jim kill me later with my regexp pattern - // below. - if (!eregi ("^(10|172\.16|192\.168)\.", $ips[$i])) { + // 192.168.0.0/16 + if (!preg_match('/^(?:10|172\.(?:1[6-9]|2\d|3[01])|192\.168)\./', $ips[$i])) { if (version_compare(phpversion(), "5.0.0", ">=")) { if (ip2long($ips[$i]) != false) { $ip = $ips[$i];

« previous php.mirrors (#34030) next »