Welcome Guest, Not a member yet? Register   Sign In
Custom validation rules?
#3

[eluser]xwero[/eluser]
Code:
class MY_Validation extends CI_Validation
{
function domain_email($str,$params)
{
   $parts = explode("@", $str);
   $domain = $parts[1];
   $allowed_array = explode(',',$params);
   //Check if $domain is in list of allowed domain - using an array here
   return in_array($domain, $allowed_array);
}
}
Use rule
Code:
$rules['email'] = 'valid_email|domain_email[gmail.com]';


Messages In This Thread
Custom validation rules? - by El Forum - 01-19-2008, 02:37 PM
Custom validation rules? - by El Forum - 01-19-2008, 02:49 PM
Custom validation rules? - by El Forum - 01-19-2008, 03:01 PM
Custom validation rules? - by El Forum - 01-19-2008, 03:16 PM
Custom validation rules? - by El Forum - 01-19-2008, 03:31 PM
Custom validation rules? - by El Forum - 01-19-2008, 04:56 PM
Custom validation rules? - by El Forum - 01-19-2008, 05:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB