summaryrefslogtreecommitdiff
path: root/kohana/libraries/Input.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-03-30 18:09:17 +0000
committerBharat Mediratta <bharat@menalto.com>2009-03-30 18:09:17 +0000
commit9f04fef3e046d7b4778ddf449589c9b1a3a67857 (patch)
tree5b3d859bd977adb15fa396d9db914f9d1b82073f /kohana/libraries/Input.php
parent066854424a683f14f70f54e3ef1879e77c409369 (diff)
Updated to r807
Diffstat (limited to 'kohana/libraries/Input.php')
-rw-r--r--kohana/libraries/Input.php21
1 files changed, 11 insertions, 10 deletions
diff --git a/kohana/libraries/Input.php b/kohana/libraries/Input.php
index 04e8ee4d..4549bf4a 100644
--- a/kohana/libraries/Input.php
+++ b/kohana/libraries/Input.php
@@ -237,17 +237,18 @@ class Input_Core {
if ($this->ip_address !== NULL)
return $this->ip_address;
- if ($ip = $this->server('HTTP_CLIENT_IP'))
- {
- $this->ip_address = $ip;
- }
- elseif ($ip = $this->server('REMOTE_ADDR'))
- {
- $this->ip_address = $ip;
- }
- elseif ($ip = $this->server('HTTP_X_FORWARDED_FOR'))
+ // Server keys that could contain the client IP address
+ $keys = array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'REMOTE_ADDR');
+
+ foreach ($keys as $key)
{
- $this->ip_address = $ip;
+ if ($ip = $this->server($key))
+ {
+ $this->ip_address = $ip;
+
+ // An IP address has been found
+ break;
+ }
}
if ($comma = strrpos($this->ip_address, ',') !== FALSE)