@eidolon Night
As far as I can see that fixed get_ip() method is not included in the latest iTSec plugin release (5.0.1).
There was a bit of new code added at the end so I’ll include the updated 5.0.1 fixed code in this topic:
public static function get_ip() {
global $itsec_globals;
if ( isset( $itsec_globals['settings']['proxy_override'] ) && true === $itsec_globals['settings']['proxy_override'] ) {
return esc_sql( $_SERVER['REMOTE_ADDR'] );
}
//Just get the headers if we can or else use the SERVER global
if ( function_exists( 'apache_request_headers' ) ) {
$headers = apache_request_headers();
} else {
$headers = $_SERVER;
}
//Get the forwarded IP if it exists
if ( array_key_exists( 'X-Forwarded-For', $headers ) &&
(
filter_var( explode(', ', $headers['X-Forwarded-For'])[0], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ||
filter_var( explode(', ', $headers['X-Forwarded-For'])[0], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) )
) {
$the_ip = explode(', ', $headers['X-Forwarded-For'])[0];
} elseif (
array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ) &&
(
filter_var( explode(', ', $headers['HTTP_X_FORWARDED_FOR'])[0], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ||
filter_var( explode(', ', $headers['HTTP_X_FORWARDED_FOR'])[0], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 )
)
) {
$the_ip = explode(', ', $headers['HTTP_X_FORWARDED_FOR'])[0];
} else if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
$the_ip = $_SERVER['REMOTE_ADDR'];
} else {
$the_ip = '';
}
return esc_sql( $the_ip );
}
Untested so use it at your own risk.
dwinden