Natively for validate some text or pattern, I use PHP regex. For this case, to validate IP I use this method
$pattern_ip = ‘/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.’.
‘(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.’.
‘(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.’.
‘(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/’;
if ( ! preg_match($pattern_ip,$ip))
{
$error_status = 1;
echo ‘is not valid ip’;
}
But recently I found an easy way in CodeIgniter, something missing from my eyes, I can use input class, the code may [...]
continue reading.....