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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Envoi d'un email</title>
</head>
<body>
<?php
include("connexion.php");
include("CarteBancaire.php");
//include("Fonctioncom.php");
echo $text;
$requete3="SELECT genre, nom, prenom
FROM t_commandes, t_clt
WHERE t_clt.k_clt = t_commandes.k_clt
AND etat = 'nouvelle'
AND STATUS = 'finalisee'";
$exe2 = mysql_query($requete3);
$i=0;
while($nom=mysql_fetch_array($exe2,MYSQL_NUM))
{
echo "<tr>";
foreach($nom as $pers)
{
echo "<td> $pers </td>";
}
$personnes[$i]=$pers;
$i++;
echo "<br></tr>";
}
echo "</tbody></table>";
echo "<br>";
foreach ($personnes as $cle=>$val){
echo 'num : '.$cle.' dest : '.$val.'<br/>';
}
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type:text/html;charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$requete="SELECT t_clt.k_clt, nom, prenom, mail, k_commande, t_commandes.paie_des_c_fr
FROM t_commandes, t_clt
WHERE t_clt.k_clt = t_commandes.k_clt
AND etat = 'nouvelle'
AND STATUS = 'finalisee'";
$result= mysql_query($requete);
if(!$result)
{
echo "Lecture impossible";
}
else
{
$nbcol=mysql_num_fields($result);
$nbemail=mysql_num_rows($result);
echo "<h3> Tous nos e-mail enregistres</h3>";
echo "<h4> Il y a $nbemail nouvelles commandes enregistre </h4>";
echo "<table border=\"1\"><tbody>";
echo "<tr><th>No client</th> <th>Nom</th> <th>Prenom</th> <th>Mail</th><th>No commande</th><th>Moyen de paiement</th></tr>";
while($ligne=mysql_fetch_array($result,MYSQL_NUM))
{
echo "<tr>";
foreach($ligne as $valeur)
{
echo "<td> $valeur </td>";
}
echo "</tr>";
}
echo "</tbody></table>";
}
mysql_free_result($result);
$dest = "";
$requete2="select mail from t_commandes, t_clt where t_clt.k_clt = t_commandes.k_clt and etat='nouvelle' and status='finalisee'";
$exe = mysql_query($requete2);
$i=0;
while($dest=mysql_fetch_array($exe,MYSQL_NUM))
{
echo "<tr>";
foreach($dest as $mail)
{
echo "<td> $mail <br></td>";
}
$destinataires[$i]=$mail;
$i++;
echo "</tr>";
}
echo "</tbody></table>";
foreach ($destinataires as $cle=>$val){
echo 'num : '.$cle.' dest : '.$val.' <br/>';
}
foreach($destinataires as $cle=>$dest ){
if(mail($dest,"FBI Distribution: votre commande No $num_com", $nom, $headers)){
echo "Envoi reussi a $dest";
}
else{
echo "Echec envoi a $dest";
}
}
?>
</body>
</html> |
Partager