I'm using the following code to check if submitted emails and ip's are valid, I'm using the following code:
class Engine {
function validateEmail($email) {
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
return TRUE;
} else {
return FALSE;
}
}
function validateIP($ip) {
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
return TRUE;
} else {
return FALSE;
}
}
}
My question is, is this a good way of validating a users email/ip?