Bas met alle respect maar zou je bij deze toch even mee kunnen helpen?Hij verstuurd de brief naar de mailadressen uit men db maar verstuurd de gehele brief 4x naar de 1ste 3x naar de 2de enz.
Waar ligt de fout?
<?
db vars
if (!@mysql_select_db("$mysqldbdb", @mysql_connect("$mysqlhost", "$mysqluser", "$mysqlpass")))
{
echo "Er kon geen connectie worden gemaakt met de database.";
exit();
}
$uit_url = "http://members.lycos.nl/thecore007/functies/registreren/nieuwsbrief";
$uitpagina ="uit.php";
$table = "verzenden";
// Ontvang alle gegevens en controleer of dit niet reeds bestaat.
if ($HTTP_POST_VARS["nieuwstitel"] && $HTTP_POST_VARS["verzendkeuze"] && $HTTP_POST_VARS["nieuwsbrieftekst"])
{
$checksql = "SELECT id FROM $table WHERE nieuwstitel = '$HTTP_POST_VARS[nieuwstitel]' AND verzendkeuze = '$HTTP_POST_VARS[verzendkeuze]' ";
$checkres = mysql_query($checksql);
if (mysql_num_rows($checkres) >= 1)
{
echo "De nieuwsbrief is al eens verstuurd.";
}
else
{
//Als het bericht nog niet bestaat zet dan alles in de tabel verzenden.
$datum = date("d.m.Y");
$sql1 = "INSERT INTO $table (id, nieuwstitel, datum, verzendkeuze, nieuwsbrieftekst) VALUES ('', '$HTTP_POST_VARS[nieuwstitel]', '$datum', '$HTTP_POST_VARS[verzendkeuze]','$HTTP_POST_VARS[nieuwsbrieftekst]')";
$res1 = mysql_query($sql1);
if ($res1)
$sql2 ="SELECT * FROM $table WHERE nieuwstitel ='$HTTP_POST_VARS[nieuwstitel]' AND datum = '$datum' AND verzendkeuze = '$HTTP_POST_VARS[verzendkeuze]'";
$res2 = mysql_query($sql2);
if ($res2)
{
while ($row2 = mysql_fetch_object($res2))
{
$sql7 ="SELECT * FROM nieuwsbrief WHERE status ='$HTTP_POST_VARS[verzendkeuze]'";
$res7 = mysql_query($sql7);
if ($res7)
while ($row7 = mysql_fetch_array($res7))
{
$jdate = date("Y");
$cdate = date("d-m-Y");
$subject = "Breezers 2000 nieuwsbrief #$row2->id $row2->nieuwstitel";
$headers = "From: Breezers 2000 TM <[email protected]>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$bericht .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$bericht .="<td width=\"1%\" align=\"center\" bgcolor=\"#A8A8A8\"";
$bericht .="background=\"http://members.lycos.nl/thecore007/images/niewsbrief2.JPG\"> </td>";
$bericht .="<td width=\"133%\" align=\"center\" bgcolor=\"#A8A8A8\"><strong><small><font face=\"Trebuchet MS\"";
$bericht .="color=\"#FFFFFF\">Z.V.C. Breezers 2000</font></small></strong></td>";
$bericht .="</tr>";
$bericht .="<tr>";
$bericht .="<td width=\"5%\"";
$bericht .="style=\"font-family: Trebuchet MS; background-color: rgb(255,255,255); color: rgb(192,192,192); border-left: 1px solid rgb(128,128,128); border-right: 0 none; border-top: medium none; border-bottom: medium none\">";
$bericht .="<p align=\"center\"><font color=\"#C0C0C0\"><br>";
$bericht .="<small>N<br>";
$bericht .="i<br>";
$bericht .="e<br>";
$bericht .="u<br>";
$bericht .="w<br>";
$bericht .="s</small><br>";
$bericht .="<small>b</small><br>";
$bericht .="<small>r</small><br>";
$bericht .="<small>i</small><br>";
$bericht .="<small>e</small><br>";
$bericht .="<small>f</small><br>";
$bericht .="</font></td>";
$bericht .="<td width=\"94%\" valign=\"top\" align=\"left\"";
$bericht .="style=\"font-family: Trebuchet MS; background-color: rgb(255,255,255); color: rgb(192,192,192); border-left: 1px solid rgb(128,128,128); border-right: 1px solid rgb(128,128,128); border-top: 0 none; border-bottom: 1px none\"";
$bericht .="bgcolor=\"#FFFFFF\"><small><small><font face=\"Trebuchet MS\">Nieuwsbrief Nr: $row2->id |";
$bericht .="Jaargang: $jdate</font></small></small><p align=\"center\"><strong><font face=\"Trebuchet MS\"><u>$row2->nieuwstitel</u></font>:</strong><br>";
$bericht .="<br>";
$bericht .="<font color=\"#C0C0C0\"><small>$row2->nieuwsbrieftekst</small></font><br>";
$bericht .="<br>";
$bericht .="<strong><u>Hoofdpunten</u>:</strong></p>";
$bericht .="<p align=\"left\"> $hoofdpunten<small>$titels</small></p>";
$bericht .="<hr color=\"#C0C0C0\">";
$bericht .="<p align=\"left\"><small> - Resultaat vorige wedstrijd: $vs1 - $vs2 >> $vs1 - $vs2<br>";
$bericht .="- Volgende wedstrijd: $ploeg1 - $ploeg2 Datum: $datum Uur: $uur Plaats: $Plaats <br>";
$bericht .="- Topschutter: $naam $voornaam met $doelpunten doelpunten.</small></p>";
$bericht .="<p align=\"left\"><small> </small></p>";
$bericht .="<p align=\"center\"><a href=\"http://www.breezers2000.be\" target=\"_blank\">";
$bericht .="<img src=\"http://users.pandora.be/Traxxx/breezers/downloads/Banner/BreezerBanner1.gif\"";
$bericht .="width=\"468\" height=\"60\" alt=\"www.breezers2000.be\" border=\"0\"></a></p>";
$bericht .="<p align=\"center\"><font face=\"Trebuchet MS\" color=\"gray\"><small>© Breezers TM 2003 All Rights Reserved</small></font></td>";
$bericht .="</tr>";
$bericht .="<tr>";
$bericht .="<td width=\"1%\" height=\"26\"";
$bericht .="background=\"http://members.lycos.nl/thecore007/images/niewsbrief1.JPG\"";
$bericht .="style=\"border-left: 0 none; border-right: 1px none; border-top: 0; border-bottom: 0 none\"></td>";
$bericht .="<td width=\"176%\" style=\"font-family: Trebuchet MS; border: 1px solid rgb(128,128,128)\"";
$bericht .="bgcolor=\"#FFFFFF\"><p align=\"center\"><font face=\"Trebuchet MS\"><small><font color=\"#C0C0C0\">Uitschrijven?";
$bericht .=" Klik <strong><a href=\"$uit_url/$uitpagina?email=$row7-nieuwsbriefmail&uit=$row7-uit\"";
$bericht .="style=\"text-decoration: none; background-color: rgb(255,255,255); color: rgb(192,192,192)\">hier</a>";
$bericht .="</strong> Datum van opstelling: $cdate</font> </small></font></td>";
$bericht .="</tr>";
$bericht .="</table>";
$zenden = $row7[nieuwsbriefmail];
}
}
}
}
}
if (mail($zenden, $subject, $bericht, $headers ))
{
echo "<font color='#808080'>De nieuwsbrief met titel $HTTP_POST_VARS[nieuwstitel] is verzonden naar $HTTP_POST_VARS[verzendkeuze]. $row7[nieuwsbriefmail]</font>\n";
}
else
{
echo "<font color='#808080'>De nieuwsbrief met titel $HTTP_POST_VARS[nieuwstitel] is niet verzonden naar $HTTP_POST_VARS[verzendkeuze].U kan het nogmaals proberen.</font>\n";
}
?>
1.388 views