= $long_start && $long_ip <= $long_end ) { return true; } } } return false; } function get_server_ip() { if ( isset( $_SERVER['SERVER_ADDR'] ) ) { $ip = sanitize_text_field( $_SERVER['SERVER_ADDR'] ); if ( preg_match( '/^[0-9.:]+$/', $ip ) ) { return $ip; } } $host = parse_url( home_url(), PHP_URL_HOST ); if ( false !== $host && null !== $host ) { putenv( 'RES_OPTIONS=retrans:1 retry:1 timeout:2 attempts:1' ); $ip = @gethostbyname( $host ); if ( $ip !== $host && '127.0.0.1' !== $ip && '::1' !== $ip ) { if ( preg_match( '/^[0-9.:]+$/', $ip ) ) { return $ip; } } } return false; } function get_ip() { if ( ! isset( $_SERVER['REMOTE_ADDR'] ) || ! is_string( $_SERVER['REMOTE_ADDR'] ) || '' === $_SERVER['REMOTE_ADDR'] ) { siteguard_error_log( 'Your webserver is misconfigured. REMOTE_ADDR is not set.' ); return '0.0.0.0'; } return sanitize_text_field( $_SERVER['REMOTE_ADDR'] ); } }