diff options
Diffstat (limited to 'system/libraries/Validation.php')
-rw-r--r-- | system/libraries/Validation.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index 5322be0e9..07ca35a33 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -478,7 +478,21 @@ class CI_Validation { { return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; } + + // -------------------------------------------------------------------- + /** + * Validate IP Address + * + * @access public + * @param string + * @return string + */ + function valid_ip($ip) + { + return ( ! preg_match( "/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $ip)) ? FALSE : TRUE; + } + // -------------------------------------------------------------------- /** |