cvs: phpweb /include ip-to-country.inc
| From: | Jacques Marneweck | Date: | Sat, 07 Aug 2004 09:34:01 +0000 |
| Subject: | cvs: phpweb /include ip-to-country.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-25719@lists.php.net to get a copy of this message | ||
jacques Sat Aug 7 05:34:01 2004 EDT
Modified files:
/phpweb/include ip-to-country.inc
Log:
Fixes merged from php-bugs-web relating to bug #29151.
http://cvs.php.net/diff.php/phpweb/include/ip-to-country.inc?r1=1.19&r2=1.20&ty=u
Index: phpweb/include/ip-to-country.inc
diff -u phpweb/include/ip-to-country.inc:1.19 phpweb/include/ip-to-country.inc:1.20
--- phpweb/include/ip-to-country.inc:1.19 Thu Sep 18 11:24:58 2003
+++ phpweb/include/ip-to-country.inc Sat Aug 7 05:34:01 2004
@@ -1,6 +1,6 @@
<?php // -*- C++ -*-
-// $Id: ip-to-country.inc,v 1.19 2003/09/18 15:24:58 goba Exp $
+// $Id: ip-to-country.inc,v 1.20 2004/08/07 09:34:01 jacques Exp $
/*
@@ -208,8 +208,17 @@
// 192.168.0.0/16 -- jim kill me later with my regexp pattern
// below.
if (!eregi ("^(10|172\.16|192\.168)\.", $ips[$i])) {
- $ip = $ips[$i];
- break;
+ if (version_compare(phpversion(), "5.0.0", ">=")) {
+ if (ip2long($ips[$i]) != false) {
+ $ip = $ips[$i];
+ break;
+ }
+ } else {
+ if (ip2long($ips[$i]) != -1) {
+ $ip = $ips[$i];
+ break;
+ }
+ }
}
}
}
@@ -218,4 +227,4 @@
return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
}
-/* vim: set noet ts=4 sw=4 ft=php: : */
+/* vim: set et ts=4 sw=4 ft=php: : */