1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
| function VerifierAdresseMail($adresse)
{
if(filter_var($adresse, FILTER_VALIDATE_EMAIL))
{
//On récupere le nom de domaine
$domaine = explode("@",$adresse);
//Si il n'est pas vide
if ((!empty($domaine[0])) and (!empty($domaine[1])))
{
if (Filtre_Nbr($domaine[0]) < 4)
{
if (Filtre_Nbr($domaine[1]) < 4)
{
if (strlen($domaine[0]) >= 3)
{
if (strlen($domaine[1]) >= 4)
{
if (($domaine[0]{0} != '.') and ($domaine[0]{0} != '-') and ($domaine[0]{0} != '_') and ($domaine[0]{strlen($domaine[0])} != '.') and ($domaine[0]{strlen($domaine[0])} != '-') and ($domaine[0]{strlen($domaine[0])} != '_'))
{
//On ouvre le fichier, si cela échoue, on affiche une erreur
if (!$fp2 = fopen('Memoire/domain_whitelist.txt',"r")) {
$_POST['logarea'] .= "Echec de l'ouverture du fichier";
} else {
//Sinon, on parcourt le fichier white list
$alpha = 'notmatch';
while(!feof($fp2))
{
// On récupère une ligne
$Ligne2 = fgets($fp2,255);
//On compare chaque ligne à chaque domaine
if (trim($domaine[1]) == trim($Ligne2))
{
//Si elles correspondent, on tague le domaine comme ok
$alpha = 'match';
}
}
fclose($fp2); // On ferme le fichier
//Si le domaine n'était pas dans la white liste, on ouvre la black list
if ($alpha == 'notmatch')
{
if (!$fp3 = fopen('Memoire/domain_blacklist.txt',"r")) {
$_POST['logarea'] .= "Echec de l'ouverture du fichier";
} else {
//On marque une variable no comme repere
$bl = 'no';
while(!feof($fp3))
{
// On récupère une ligne
$Ligne3 = fgets($fp3,255);
if (trim($domaine[1]) == trim($Ligne3))
{
//Si on rencontre le domaine dans la black list on change le tag à yes
$bl = 'yes';
}
}
//Si le tag est à yes alors on a une mauvaise adresse
fclose($fp3); // On ferme le fichier
if ($bl == 'yes')
{
$alpha = 'notmatch';
} else
{
//Si il vaut no c'est que le domaine n'a encore jamais été rencontré, on va devoir le vérifier
if(checkdnsrr(strtolower(trim($domaine[1])),'A'))
{
//Si il est ok
$fichier1=fopen('Memoire/domain_whitelist.txt', 'a+');
fwrite($fichier1,trim($domaine[1])." \n");
fclose ($fichier1);
$alpha = 'match';
$fichier3=fopen('Memoire/temoins.txt', 'a+');
fwrite($fichier3,trim($domaine[0]).' @ '.trim($domaine[1])." DNS validé \n");
fclose ($fichier3);
usleep(1500000);
} else {
//Sinon on note que c'est une erreur
$fichier2=fopen('Memoire/domain_blacklist.txt', 'a+');
fwrite($fichier2,trim($domaine[1])." \n");
fclose ($fichier2);
$alpha = 'notmatch';
$fichier3=fopen('Memoire/temoins.txt', 'a+');
fwrite($fichier3,trim($domaine[0]).' @ '.trim($domaine[1])." DNS invalidé \n");
fclose ($fichier3);
usleep(1500000);
}
}
}
} else {
$alpha = 'match';
}
}
} else
{
$alpha = 'notmatch';
}
} else
{
$alpha = 'notmatch';
}
} else
{
$alpha = 'notmatch';
}
} else
{
$alpha = 'notmatch';
}
} else
{
$alpha = 'notmatch';
}
} else
{
$alpha = 'notmatch';
}
}
else
{
$alpha = 'notmatch';
}
return $alpha;
} |
Partager