diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-03-30 18:09:17 +0000 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-03-30 18:09:17 +0000 |
| commit | 9f04fef3e046d7b4778ddf449589c9b1a3a67857 (patch) | |
| tree | 5b3d859bd977adb15fa396d9db914f9d1b82073f /kohana/libraries/Input.php | |
| parent | 066854424a683f14f70f54e3ef1879e77c409369 (diff) | |
Updated to r807
Diffstat (limited to 'kohana/libraries/Input.php')
| -rw-r--r-- | kohana/libraries/Input.php | 21 |
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) |
