diff options
author | Craig Andrews <candrews@integralblue.com> | 2009-08-02 18:13:10 -0400 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2009-08-02 18:13:10 -0400 |
commit | c65056aa8d711804c8b365542db3890db425ae5a (patch) | |
tree | 66fc66d27c8cbb3e5e32be475d3f0bd61ce39ec4 /lib/util.php | |
parent | fdaba2e94bf4948c14408c14865e8fc03e33cc43 (diff) | |
parent | e670e4306bf3e0e7e90523bcbfa2eb8060f4ed67 (diff) |
Merge commit 'jeff-themovie/0.8.x-small-fixes-2' into 0.8.x
Diffstat (limited to 'lib/util.php')
-rw-r--r-- | lib/util.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/util.php b/lib/util.php index d784bb793..c8e318efe 100644 --- a/lib/util.php +++ b/lib/util.php @@ -140,7 +140,7 @@ function common_have_session() function common_ensure_session() { $c = null; - if (array_key_exists(session_name, $_COOKIE)) { + if (array_key_exists(session_name(), $_COOKIE)) { $c = $_COOKIE[session_name()]; } if (!common_have_session()) { @@ -1410,20 +1410,21 @@ function common_client_ip() return null; } - if ($_SERVER['HTTP_X_FORWARDED_FOR']) { - if ($_SERVER['HTTP_CLIENT_IP']) { + if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) { + if (array_key_exists('HTTP_CLIENT_IP', $_SERVER)) { $proxy = $_SERVER['HTTP_CLIENT_IP']; } else { $proxy = $_SERVER['REMOTE_ADDR']; } $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { - if ($_SERVER['HTTP_CLIENT_IP']) { + $proxy = null; + if (array_key_exists('HTTP_CLIENT_IP', $_SERVER)) { $ip = $_SERVER['HTTP_CLIENT_IP']; } else { $ip = $_SERVER['REMOTE_ADDR']; } } - return array($ip, $proxy); + return array($proxy, $ip); } |