From: Jan Schneider Date: Thu, 1 Oct 2009 13:37:37 +0000 (+0200) Subject: Add getIPAddress() (Bug #8620). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a55039a2e529dd27e38d1a355ea61dbad0f2fa15;p=horde.git Add getIPAddress() (Bug #8620). --- diff --git a/framework/Browser/lib/Horde/Browser.php b/framework/Browser/lib/Horde/Browser.php index bedb46d1e..4520c1d51 100644 --- a/framework/Browser/lib/Horde/Browser.php +++ b/framework/Browser/lib/Horde/Browser.php @@ -961,6 +961,18 @@ class Horde_Browser } /** + * Returns the IP address of the client. + * + * @return string The client IP address. + */ + public function getIPAddress() + { + return empty($_SERVER['HTTP_X_FORWARDED_FOR']) + ? $_SERVER['REMOTE_ADDR'] + : $_SERVER['HTTP_X_FORWARDED_FOR']; + } + + /** * Determines if files can be uploaded to the system. * * @return integer If uploads allowed, returns the maximum size of the