PluginProbe
The WP Remote WordPress Plugin / 4.65
The WP Remote WordPress Plugin v4.65
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
wpremote / protect / base.php

base.php in The WP Remote WordPress Plugin 4.65, at protect/base.php

29 lines 798 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (! (defined('ABSPATH') || defined('MCDATAPATH')) ) exit;
3 if (!class_exists('BVProtectBase')) :
4
5 class BVProtectBase {
6 public static function getIP($ipHeader) {
7 $ip = '127.0.0.1';
8 if ($ipHeader && is_array($ipHeader)) {
9 if (array_key_exists($ipHeader['hdr'], $_SERVER)) {
10 $_ips = preg_split("/(,| |\t)/", $_SERVER[$ipHeader['hdr']]);
11 if (array_key_exists(intval($ipHeader['pos']), $_ips)) {
12 $ip = $_ips[intval($ipHeader['pos'])];
13 }
14 }
15 } else if (array_key_exists('REMOTE_ADDR', $_SERVER)) {
16 $ip = $_SERVER['REMOTE_ADDR'];
17 }
18
19 $ip = trim($ip);
20 if (preg_match('/^\[([0-9a-fA-F:]+)\](:[0-9]+)$/', $ip, $matches)) {
21 $ip = $matches[1];
22 } elseif (preg_match('/^([0-9.]+)(:[0-9]+)$/', $ip, $matches)) {
23 $ip = $matches[1];
24 }
25
26 return $ip;
27 }
28 }
29 endif;