summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2011-09-12 04:45:39 +0200
committerBo-Yi Wu <appleboy.tw@gmail.com>2011-09-12 04:45:39 +0200
commitc9f84c1f916a7f3b92b02e45cc8c1cd9a040436b (patch)
tree915e3590cb3ff60c4bbf443a1509e004d0ee5a25 /system
parent869e3721d75e9798a706d24d93170f44e5ab6cb3 (diff)
Update: if php version >= 5.2, use filter_var to check validate ip.
Diffstat (limited to 'system')
-rwxr-xr-xsystem/core/Input.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index 0dc2c4550..f99adad01 100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -373,6 +373,12 @@ class CI_Input {
*/
function valid_ip($ip)
{
+ // if php version >= 5.2, use filter_var to check validate ip.
+ if(is_php('5.2'))
+ {
+ return (bool) filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
+ }
+
$ip_segments = explode('.', $ip);
// Always 4 segments needed