par
Invité » 27 juil. 2007, 11:24
Voilà je viens de terminer
Oups je suis pas identifier, tampis
Voilà la fonction entière qui peut être amélioré mais c'est une base
function verifmail($mail) {
$ext_ok= array('.fr','.com','.net','.org');
if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",$mail)) { // VERIFIER CARACTERES
$after= strstr($mail, '@'); // RECUPERER CARACTERES A PARTIR DU AROBASE
echo '<p>Resultat : '.$after.'</p>'; // DEBUG
$last= substr($mail,-5);// RECUPERER 5 DERNIERS CARACTERES
echo '<p>Resultat : '.$last.'</p>'; // DEBUG
if (ereg("\.",$last)) { // VERIFIER PRESENCE POINT EN FIN DE CHAINE
$pos_point= strrpos($last, '.'); // RECUPERER VALEUR NUMERIQUE POSITION DU POINT
echo '<p>Resultat : '.$pos_point.'</p>'; // DEBUB
$ext= strstr($last, '.'); // RECUPERER CARACTERES A PARTIR DU POINT
echo '<p>'.$ext.'</p>'; // DEBUG
if (in_array($ext,$ext_ok)) {
echo 'Adresse valide'; // BINGO
}
}
else {
echo '<p>Pas de POINT dans les 4 derniers caracteres</p>';
}
}
else {
echo '<p>Caracteres invalides OU pas de POINT / AROBASE</p>';
}
}
Voilà je viens de terminer
Oups je suis pas identifier, tampis :roll:
Voilà la fonction entière qui peut être amélioré mais c'est une base :wink:
[php]
function verifmail($mail) {
$ext_ok= array('.fr','.com','.net','.org');
if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",$mail)) { // VERIFIER CARACTERES
$after= strstr($mail, '@'); // RECUPERER CARACTERES A PARTIR DU AROBASE
echo '<p>Resultat : '.$after.'</p>'; // DEBUG
$last= substr($mail,-5);// RECUPERER 5 DERNIERS CARACTERES
echo '<p>Resultat : '.$last.'</p>'; // DEBUG
if (ereg("\.",$last)) { // VERIFIER PRESENCE POINT EN FIN DE CHAINE
$pos_point= strrpos($last, '.'); // RECUPERER VALEUR NUMERIQUE POSITION DU POINT
echo '<p>Resultat : '.$pos_point.'</p>'; // DEBUB
$ext= strstr($last, '.'); // RECUPERER CARACTERES A PARTIR DU POINT
echo '<p>'.$ext.'</p>'; // DEBUG
if (in_array($ext,$ext_ok)) {
echo 'Adresse valide'; // BINGO
}
}
else {
echo '<p>Pas de POINT dans les 4 derniers caracteres</p>';
}
}
else {
echo '<p>Caracteres invalides OU pas de POINT / AROBASE</p>';
}
}
[/php]