1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| //CETTE FONCTION VA NETTOYER L'ADRESSE EMAIL ENTRE DANS LE FORMULAIRE
function clean_email($email)
{
$email = trim($email);
$email = str_replace(" ", "", $email);
$search = array('@[éèêëÊË]@i','@[ãàâäÂÄ]@i','@[îïÎÏ]@i','@[ûùüÛÜ]@i','@[õôöÔÖ]@i','@[ç]@i','@[ ]@i');
$replace = array('e','a','i','u','o','c','');
$email = preg_replace($search, $replace, $email);
$email = preg_replace("#[\;\#\n\r\*\'\"<>&\%\!\(\)\{\}\[\]\?\\/\s\¨\|\=\¦\¬\¢\~\,\^\\$\£]#", "", $email);
if (preg_match("/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/", $email))
{
return $email;
}
else
{
return false;
}
} |
Partager