0){ throw new Exception("Erreur lors de l'inscription*"); } } static function cleanString(string &$str) { $str = preg_replace('/[^A-Za-z\-]/', '', $str); if($str == null || $str == '') { return null; } return $str; } static function cleanMail(string &$str) { $str = preg_replace('/[^A-Za-z\-\^0-9\.\@]/', '', $str); if($str == null || $str == '') { return null; } return $str; } static function val_form_add(string &$nom,string &$description,&$dVueEreur) { $nom = Validation::cleanText($nom); if ($nom == NULL) { $dVueEreur['nom'] = "Veuillez entrer un nom*"; } $description = Validation::cleanText($description); if ($description == NULL) { $dVueEreur['description'] = "Veuillez entrer une description*"; } if(count($dVueEreur)>0){ throw new Exception("Problème lors de l'ajout"); } } static function cleanText(string &$txt) { $txt = preg_replace('/[^A-Za-z\-\^0-9\ ]/', '', $txt); if($txt == null || $txt == '') { return null; } return $txt; } static function val_mail(string &$mail) { if(filter_var($mail, FILTER_VALIDATE_EMAIL)) { return $mail; } return null; } static function val_string(string &$str) { if(filter_var($str, FILTER_SANITIZE_STRING)!=$str) { return null; } return $str; } static function cleanInt(string &$int) { $int = preg_replace('/[^0-9]/', '', $int); if($int == null || $int == '') { return null; } return intval($int); } } ?>