summaryrefslogtreecommitdiffstats
path: root/system/core/Input.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-12 08:26:10 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-12 08:26:10 +0100
commit6f0fd79754d29e8f0dde8d3d385e8338eadce61e (patch)
tree607d63c49024b5093a5f5538a57b9911449a3559 /system/core/Input.php
parent0aa9f2e86124194cd64fde098ba7a4169625d353 (diff)
parent3d933b6fad72d4b92f18187dd57f1d3c35f8936a (diff)
Merge upstream branch
Diffstat (limited to 'system/core/Input.php')
-rwxr-xr-xsystem/core/Input.php33
1 files changed, 2 insertions, 31 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index 5a4659a5a..901b4147e 100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -366,36 +366,7 @@ class CI_Input {
*/
public function valid_ip($ip)
{
- // if php version >= 5.2, use filter_var to check validate ip.
- if (function_exists('filter_var'))
- {
- return (bool) filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
- }
-
- $ip_segments = explode('.', $ip);
-
- // Always 4 segments needed
- if (count($ip_segments) !== 4)
- {
- return FALSE;
- }
- // IP can not start with 0
- if ($ip_segments[0][0] == '0')
- {
- return FALSE;
- }
- // Check each segment
- foreach ($ip_segments as $segment)
- {
- // IP segments must be digits and can not be
- // longer than 3 digits or greater then 255
- if ($segment == '' OR preg_match('/[^0-9]/', $segment) OR $segment > 255 OR strlen($segment) > 3)
- {
- return FALSE;
- }
- }
-
- return TRUE;
+ return (bool) filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
}
// --------------------------------------------------------------------