public/wordpress/wp-content/plugins/wp-courseware/includes/functions/utilities.php
/**
 * Get the User IP Address.
 *
 * @since 4.3.0
 *
 * @return string The current user ip address.
 */
Get the User IP Address.

@return string The current user ip address.
Get the User IP Address . @return string The current user ip address .
function wpcw_user_ip_address() {
	if ( isset( $_SERVER['HTTP_X_REAL_IP'] ) ) {
		return sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REAL_IP'] ) );
	} elseif ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
		return (string) rest_is_ip_address( trim( current( preg_split( '/[,:]/', sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) ) ) ) );
	} elseif ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
		return sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) );
	}
	return '';
}
function wpcw_user_ip_address ( ) { if ( isset ( $ _SERVER [ 'HTTP_X_REAL_IP' ] ) ) { return sanitize_text_field ( wp_unslash ( $ _SERVER [ 'HTTP_X_REAL_IP' ] ) ) ; } elseif ( isset ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) ) { return ( string ) rest_is_ip_address ( trim ( current ( preg_split ( '/[,:]/' , sanitize_text_field ( wp_unslash ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) ) ) ) ) ) ; } elseif ( isset ( $ _SERVER [ 'REMOTE_ADDR' ] ) ) { return sanitize_text_field ( wp_unslash ( $ _SERVER [ 'REMOTE_ADDR' ] ) ) ; } return '' ; }
Get the User IP Address.
Get the User IP Address .
// Proxy servers can send through this header like this: X-Forwarded-For: client1, proxy1, proxy2 // Make sure we always only send through the first IP in the list which should always be the client IP.