aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Clay <steve@mrclay.org>2013-12-07 20:27:32 -0500
committerSteve Clay <steve@mrclay.org>2013-12-07 20:35:26 -0500
commitf4420e017f6dc2039e8e3910e5b98c0eb17a7be2 (patch)
treecd337d1c60eedbfa428a4350c36f91e97a3219bd
parent752f946f8de8660972075d6bcfe18181a450a216 (diff)
downloadelgg-f4420e017f6dc2039e8e3910e5b98c0eb17a7be2.tar.gz
elgg-f4420e017f6dc2039e8e3910e5b98c0eb17a7be2.tar.bz2
Fixes #6012: Gets correct client IP behind proxy (1.8)
-rw-r--r--engine/lib/system_log.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php
index 5a153afb2..bed863755 100644
--- a/engine/lib/system_log.php
+++ b/engine/lib/system_log.php
@@ -187,7 +187,11 @@ function system_log($object, $event) {
$object_subtype = $object->getSubtype();
$event = sanitise_string($event);
$time = time();
- $ip_address = sanitise_string($_SERVER['REMOTE_ADDR']);
+ if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
+ $ip_address = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
+ } else {
+ $ip_address = sanitise_string($_SERVER['REMOTE_ADDR']);
+ }
$performed_by = elgg_get_logged_in_user_guid();
if (isset($object->access_id)) {