From a4b3217bd1760611fc3616e293542a21375bd2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Mon, 3 Sep 2007 09:59:43 +0000 Subject: #169263 by Gerhard Killesreiter: fix IP address identification --- includes/bootstrap.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 2d9034abb..bcf94f7ea 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -1111,8 +1111,9 @@ function ip_address() { if (!isset($ip_address)) { $ip_address = $_SERVER['REMOTE_ADDR']; if (variable_get('reverse_proxy', 0) && array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) { - // If there are several arguments, the leftmost one is the farthest client - list($ip_address, ) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); + // If there are several arguments, we need to check the most + // recently added one, ie the last one. + $ip_address = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])); } } -- cgit v1.2.3