aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Sroka <srokap@gmail.com>2013-12-08 04:13:02 +0100
committerSteve Clay <steve@mrclay.org>2013-12-08 14:27:36 -0500
commit5866c12f7b5cc7c9fa922324a26c419a66fc5ea3 (patch)
treec1304dbf3e0da7a492ccaeda87c058c55b0684bb
parentf4420e017f6dc2039e8e3910e5b98c0eb17a7be2 (diff)
downloadelgg-5866c12f7b5cc7c9fa922324a26c419a66fc5ea3.tar.gz
elgg-5866c12f7b5cc7c9fa922324a26c419a66fc5ea3.tar.bz2
Checks X-Real-Ip header as well when determining client IP
-rw-r--r--engine/lib/system_log.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php
index bed863755..84302632e 100644
--- a/engine/lib/system_log.php
+++ b/engine/lib/system_log.php
@@ -187,11 +187,16 @@ function system_log($object, $event) {
$object_subtype = $object->getSubtype();
$event = sanitise_string($event);
$time = time();
+
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip_address = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
+ } elseif (!empty($_SERVER['HTTP_X_REAL_IP'])) {
+ $ip_address = array_pop(explode(',', $_SERVER['HTTP_X_REAL_IP']));
} else {
- $ip_address = sanitise_string($_SERVER['REMOTE_ADDR']);
+ $ip_address = $_SERVER['REMOTE_ADDR'];
}
+ $ip_address = sanitise_string($ip_address);
+
$performed_by = elgg_get_logged_in_user_guid();
if (isset($object->access_id)) {