par
rossy » 05 mai 2006, 15:18
Je n'y comprend plus rien pourquoi ce mail est il envoyé deux fois avec quelque seconde d'écare.
Il n'est pas executé deux fois les adresses ne sont pas identiques.
Le code de ma page :
<?php
require_once("security.php");
$id = $_GET['id'];
$date = date("d/m/Y");
$nb=mysql_query("SELECT * FROM couleur_banniere ");
while($row = mysql_fetch_array($nb)) { // selection
$domaine = "http://".$row['domaine']."";
$domaine1 = $row['domaine'];
$nom = $row['nom_club'];
$realisateur = $row['realisateur'];
} ?>
<!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>
<title>NEWSLETTER N°<?php echo $id; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="../css/css.css" />
<meta name="language" content="fr-FR" />
<meta name="robots" content="index, follow" />
<meta name="Description" content="<?php echo $description; ?>" />
<meta name="Keywords" content="<?php echo $mot_cle; ?>" />
<meta name="author" content="Leichtweis Horst" />
<script type="text/javascript">
function fermer() {
window.close();
}
</script>
</head>
<body>
<?php
$nb_enregistrement=mysql_query("SELECT * FROM newsletter_edit where id = '$id' ");
while($rowaffich = mysql_fetch_array($nb_enregistrement)) { // selection ?>
<table align="center" width="600" cellpadding="2" cellspacing="2" border="0" class="textcreation">
<tr>
<td align="right" valign="middle"><img src="../images/ballon1.jpg" align="absmiddle"/></td>
<td align="center" valign="middle"><font face="Georgia, Times New Roman, Times, serif" size="+4" color="#FF8000"><?php echo $domaine1; ?></font><br />Le site officiel de <?php echo $nom; ?></td>
<td align="left" valign="middle"><img src="../images/ballon1.jpg" align="absmiddle"/></td>
</tr>
<tr>
<td align="left" valign="top" colspan="3"><br /><br /><h4><font color="#0080FF"><u>Lettre d'information N°<?php echo $id; ?></u></font></h4></td>
</tr>
<tr>
<td align="left" valign="top" colspan="3"><u><?php echo $rowaffich['titre']; ?></u><br /></td>
</tr>
<tr>
<td align="left" valign="top" colspan="3"><br /><?php echo nl2br($rowaffich['message']); ?><br /></td>
</tr>
<tr>
<td align="left" valign="top" colspan="3"><br /><br /><font size="-2">Réalisé par <?php echo $realisateur; ?><br /><a href="<?php echo $domaine; ?>"><?php echo $domaine; ?></a></font><br /></td>
</tr>
<tr>
<td align="center" valign="top" colspan="3"><font size="-2">Vous ne souhaitez plus recevoir de Newsletter : <a href="<?php echo $domaine; ?>/newsletter.php">Cliquez ici</a><br /><hr /><br /></font></td>
</tr>
</table>
<table align="center" width="600" cellpadding="2" cellspacing="2" border="0" class="textcreation">
<tr>
<td align="center" valign="top"><form action="apercunews.php?id=<?php echo $id; ?>&envoyer=oui" method="post" enctype="multipart/form-data"><input name="submit" type="submit" value="Envoyer" /></form></td>
</tr>
</table>
<?php }
if (isset($_GET['envoyer'])) {
$nb_enregistrement=mysql_query("SELECT * FROM newsletter_edit where id = '$id' ");
while($rowaffich = mysql_fetch_array($nb_enregistrement)) { // selection
$message=addslashes($rowaffich['message']);
}
/* Expédition du mail */
$des=mysql_query("SELECT * FROM newsletter");
while($rowdes = mysql_fetch_array($des)) { // selection
$destinataire = $rowdes['mail'];
/* sujet destinataire */
$subject = "NEWSLETTER N°".$id."";
/* Pour envoyer le courrier en html, on peut placer le contenu-type de l'en tête. destinataire */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$domaine1."\r\n";
mail($destinataire, $subject, $message, $headers);
}
echo '<center>La NEWSLETTER a été envoyée</center><br>';
} ?>
<center><a href="javascript:fermer();"><font color="#5A56EA">Fermer</font></a></center>
</body>
</html>
Je n'y comprend plus rien pourquoi ce mail est il envoyé deux fois avec quelque seconde d'écare.
Il n'est pas executé deux fois les adresses ne sont pas identiques.
Le code de ma page :
[php]
<?php
require_once("security.php");
$id = $_GET['id'];
$date = date("d/m/Y");
$nb=mysql_query("SELECT * FROM couleur_banniere ");
while($row = mysql_fetch_array($nb)) { // selection
$domaine = "http://".$row['domaine']."";
$domaine1 = $row['domaine'];
$nom = $row['nom_club'];
$realisateur = $row['realisateur'];
} ?>
<!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>
<title>NEWSLETTER N°<?php echo $id; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="../css/css.css" />
<meta name="language" content="fr-FR" />
<meta name="robots" content="index, follow" />
<meta name="Description" content="<?php echo $description; ?>" />
<meta name="Keywords" content="<?php echo $mot_cle; ?>" />
<meta name="author" content="Leichtweis Horst" />
<script type="text/javascript">
function fermer() {
window.close();
}
</script>
</head>
<body>
<?php
$nb_enregistrement=mysql_query("SELECT * FROM newsletter_edit where id = '$id' ");
while($rowaffich = mysql_fetch_array($nb_enregistrement)) { // selection ?>
<table align="center" width="600" cellpadding="2" cellspacing="2" border="0" class="textcreation">
<tr>
<td align="right" valign="middle"><img src="../images/ballon1.jpg" align="absmiddle"/></td>
<td align="center" valign="middle"><font face="Georgia, Times New Roman, Times, serif" size="+4" color="#FF8000"><?php echo $domaine1; ?></font><br />Le site officiel de <?php echo $nom; ?></td>
<td align="left" valign="middle"><img src="../images/ballon1.jpg" align="absmiddle"/></td>
</tr>
<tr>
<td align="left" valign="top" colspan="3"><br /><br /><h4><font color="#0080FF"><u>Lettre d'information N°<?php echo $id; ?></u></font></h4></td>
</tr>
<tr>
<td align="left" valign="top" colspan="3"><u><?php echo $rowaffich['titre']; ?></u><br /></td>
</tr>
<tr>
<td align="left" valign="top" colspan="3"><br /><?php echo nl2br($rowaffich['message']); ?><br /></td>
</tr>
<tr>
<td align="left" valign="top" colspan="3"><br /><br /><font size="-2">Réalisé par <?php echo $realisateur; ?><br /><a href="<?php echo $domaine; ?>"><?php echo $domaine; ?></a></font><br /></td>
</tr>
<tr>
<td align="center" valign="top" colspan="3"><font size="-2">Vous ne souhaitez plus recevoir de Newsletter : <a href="<?php echo $domaine; ?>/newsletter.php">Cliquez ici</a><br /><hr /><br /></font></td>
</tr>
</table>
<table align="center" width="600" cellpadding="2" cellspacing="2" border="0" class="textcreation">
<tr>
<td align="center" valign="top"><form action="apercunews.php?id=<?php echo $id; ?>&envoyer=oui" method="post" enctype="multipart/form-data"><input name="submit" type="submit" value="Envoyer" /></form></td>
</tr>
</table>
<?php }
if (isset($_GET['envoyer'])) {
$nb_enregistrement=mysql_query("SELECT * FROM newsletter_edit where id = '$id' ");
while($rowaffich = mysql_fetch_array($nb_enregistrement)) { // selection
$message=addslashes($rowaffich['message']);
}
/* Expédition du mail */
$des=mysql_query("SELECT * FROM newsletter");
while($rowdes = mysql_fetch_array($des)) { // selection
$destinataire = $rowdes['mail'];
/* sujet destinataire */
$subject = "NEWSLETTER N°".$id."";
/* Pour envoyer le courrier en html, on peut placer le contenu-type de l'en tête. destinataire */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$domaine1."\r\n";
mail($destinataire, $subject, $message, $headers);
}
echo '<center>La NEWSLETTER a été envoyée</center><br>';
} ?>
<center><a href="javascript:fermer();"><font color="#5A56EA">Fermer</font></a></center>
</body>
</html>
[/php]