Added support for IP Address Range Masks (e.g. 192.168.137.0/24) to the Proxy IPs config option
diff --git a/system/core/Input.php b/system/core/Input.php
index 162e40c..c0c85a5 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -330,10 +330,27 @@
 
 		if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR'))
 		{
+			$hasRanges = strpos($proxies, '/') !== false;
 			$proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY);
 			$proxies = is_array($proxies) ? $proxies : array($proxies);
-
-			$this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
+		
+			if ($hasRanges) {
+				$longIP = ip2long($_SERVER['REMOTE_ADDR']);
+				$bit32 = 1 << 32;
+		
+				foreach($proxies as $ip) {
+					list($address, $maskLength) = explode('/', $ip);
+		
+					$bitmask = $bit32 - (1 << (32 - (int)$maskLength));
+		
+					if (($longIP & $bitmask) == $address) {
+						$this->ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
+						break;
+					}
+				}
+			} else {
+				$this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
+			}
 		}
 		elseif ( ! $this->server('HTTP_CLIENT_IP') && $this->server('REMOTE_ADDR'))
 		{