X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=includes%2FProxyTools.php;h=cf19119571dfbb6a6794b20538de678faa78acb6;hb=50f2612218fa7df442cf93f688c2c5a0162199a5;hp=d335faee9307fef25197262fc8f81b04478fe8be;hpb=3189295c065c4fe4f38aac5c9a67084cdb326dd2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index d335faee93..cf19119571 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -32,8 +32,12 @@ function wfGetIP() if ( count( $trustedProxies ) ) { # Append XFF on to $ipchain if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { - $ipchain = array_merge( $ipchain, array_map( 'trim', explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) ); + $xff = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ); + for ( $i = 1; $i <= count( $xff ); $i++ ) { + $ipchain[$i] = trim( $xff[count($xff) - $i ); + } } + var_dump( $ipchain ); # Step through XFF list and find the last address in the list which is a trusted server # Set $ip to the IP address given by that trusted server, unless the address is not sensible (e.g. private) foreach ( $ipchain as $i => $curIP ) {