[limb-svn] r6878 - 3.x/trunk/limb/net/src
svn at limb-project.com
svn at limb-project.com
Mon Mar 31 19:55:58 MSD 2008
Author: wiliam
Date: 2008-03-31 19:55:58 +0400 (Mon, 31 Mar 2008)
New Revision: 6878
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6878
Modified:
3.x/trunk/limb/net/src/lmbIp.class.php
Log:
-- lmbIp :: getRealIp() added;
Modified: 3.x/trunk/limb/net/src/lmbIp.class.php
===================================================================
--- 3.x/trunk/limb/net/src/lmbIp.class.php 2008-03-31 13:29:51 UTC (rev 6877)
+++ 3.x/trunk/limb/net/src/lmbIp.class.php 2008-03-31 15:55:58 UTC (rev 6878)
@@ -81,6 +81,18 @@
function isValid($ip)
{
return ip2long($ip) !== false;
+ }
+
+ static function getRealIp()
+ {
+ if(!empty($_SERVER['HTTP_CLIENT_IP']))
+ return $_SERVER['HTTP_CLIENT_IP'];
+
+ elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
+ return $_SERVER['HTTP_X_FORWARDED_FOR'];
+
+ else
+ return $_SERVER['REMOTE_ADDR'];
}
}
More information about the limb-svn
mailing list