website logo
Auteur
avatar
arnodu59

Forum » » Le coin des codeurs » » [Résolu] - Prob de class, help me


Posté : 29 janv. 2005 à 14:44 icone du post

Comment ça pas super propre ?



<?
// Vérifie la validité d'un email
function verifie_email($email){
  global 
$erreur;
  if (
strrpos($email,' ') > 0) { $erreur->email("espace", ""); }
  if (strlen($email) < 6) { $erreur->email("court", ""); }
  if (strlen($email) > 255) { $erreur->email("long", ""); }
  if (!ereg("@", $email)) { $erreur->email("arobase", ""); }
  if (preg_match_all("/([^a-zA-Z0-9_
\@\.\-])/i", $email, $trouve))
  {
    $erreur->email("interdit", implode(", ", $trouve[0]));  
  }
  if (!preg_match("/^([a-z0-9_]|
\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$/i", $email))
  {
    $erreur->email("incorrect", "");
  }
  list($compte, $domaine)=split("@", $email, 2);
  if (!checkdnsrr($domaine, "MX")){
    $erreur->email("incorrect_domaine", "$domaine");
  }
  return TRUE;
}
?>




Ca me parais propre... Non

Cet article provient de NPDS
https://www.npds.org/viewtopic.php?topic=15333&forum=5