Hoi,
Ik heb een programma gemaakt om nieuws brieven uit te sturen naar leden (± 2600) van onze vereniging.
Ergens loopt het fout want na 26 mails stopt het programma gewoon zonder fout melding.
------------------------------------------------------------
<html>
<head>
<meta http-equiv="refresh" content="3600">
</head>
<body>
<?php
$dag = date('d')-1;
if ($dag < 10)
{
$dag = "0".$dag;
}
$mnd = date('m');
$jr = date('Y');
$datum = $jr.'-'.$mnd.'-'.$dag.' 00:00:00';
$dag = date('d');
$datum2 = $jr.'-'.$mnd.'-'.$dag.' 00:00:00';
$koper = '1';
$koper1 = '0';
$koper2 = '11';
$server = "localhost";
$user = "";
$pass = "";
$database = "plant";
/* connectie naar mysql */
$dbh = mysql_connect($server,$user,$pass);
/* connectie met de database */
mysql_select_db($database,$dbh) or die('Database niet beschikbaar '.mysql_error());
$requete_sql = "select * from prijs where bijgewerkt > '".$datum."' and bijgewerkt < '".$datum2."'";
/* het resultaat opbouwen */
$query_result = mysql_query($requete_sql,$dbh);
/* vind ie iets? */
if (mysql_num_rows($query_result) > 0)
{
echo "ter is iets gevonden<br>";
$headers = "";
$message = "";
$subject = "Lijst van de op $dag - $mnd - $jr bijgewerkte of aangemaakte artikels # Liste des articles mis a jour ou nouvelles article du $dag - $mnd - $jr # List of the article updated or created on $dag - $mnd - $jr";
$message = '
<html>
<head>
<title>Lijst van de op $dag - $mnd - $jr bijgewerkte of aangemaakte artikels || Liste des articles mis a jour ou nouvelles article du $dag - $mnd - $jr || List of the article updated or created on $dag - $mnd - $jr </title>
</head>
<body bgcolor="#FFFFCC">
<p>test</p>
<HR>
<table border=1>
<tr>
<th><font size=2>Soortnaam</font></th><th><font size=2>Extra info</font></th><th><font size=2>Plantvorm</font></th><th><font size=2>Pot</font></th><th><font size=2>Hoogte</font></th><th><font size=2>Breedte</font></th><th><font size=2>[]</font></th><th><font size=2>CC</font></th><th><font size=2>€/-CC</font></th><th><font size=2>€/CC</font></th><th><font size=2> +CC </font></th><th><font size=2>€/+CC</font></th><th><font size=2>Producent</font></th>
</tr>
<tr>
<th><font size=2>Varietee</font></th><th><font size=2>Extra info</font></th><th><font size=2>Modelle</font></th><th><font size=2>Pot</font></th><th><font size=2>Hauteur</font></th><th><font size=2>Largeur</font></th><th><font size=2>[]</font></th><th><font size=2>CC</font></th><th><font size=2>€/-CC</font></th><th><font size=2>€/CC</font></th><th><font size=2> +CC </font></th><th><font size=2>€/+CC</font></th><th><font size=2>Producteur</font></th>
</tr>
<tr>
<th><font size=2>Variety</font></th><th><font size=2>Extra information</font></th><th><font size=2>Shape</font></th><th><font size=2>Pot</font></th><th><font size=2>Height</font></th><th><font size=2>Width</font></th><th><font size=2>[]</font></th><th><font size=2>CC</font></th><th><font size=2>€/-CC</font></th><th><font size=2>€/CC</font></th><th><font size=2> +CC </font></th><th><font size=2>€/+CC</font></th><th><font size=2>Grower</font></th>
</tr>
<tr>';
$wk1 = date('W');
if ($wk1 < 10)
{
$wk1 = 'wk0'.$wk1;
}
else
{
$wk1 = 'wk'.$wk1;
}
$wk2 = date('W')+1;
if ($wk2 > '52')
{
$wk2 = 'wk0'.($wk2-52);
}
else
{
if ($wk2 < '10')
{
$wk2 = 'wk0'.$wk2;
}
else
{
$wk2 = 'wk'.$wk2;
}
}
$wk3 = date('W')+2;
if ($wk3 > '52')
{
$wk3 = 'wk0'.($wk3-52);
}
else
{
if ($wk3 < '10')
{
$wk3 = 'wk0'.$wk3;
}
else
{
$wk3 = 'wk'.$wk3;
}
}
$wk4 = date('W')+3;
if ($wk4 > '52')
{
$wk4 = 'wk0'.($wk4-52);
}
else
{
if ($wk4 < '10')
{
$wk4 = 'wk0'.$wk4;
}
else
{
$wk4 = 'wk'.$wk4;
}
}
$wk5 = date('W')+4;
if ($wk5 > '52')
{
$wk5 = 'wk0'.($wk5-52);
}
else
{
if ($wk5 < '10')
{
$wk5 = 'wk0'.$wk5;
}
else
{
$wk5 = 'wk'.$wk5;
}
}
$requete_sql = "select om.om_français,om.productcod,prijs.$wk1,prijs.$wk2,prijs.$wk3,prijs.$wk4,prijs.$wk5,prijs.bijgewerkt,prijs.groepscode,prijs.s05_rijphd,prijs.p_f_0,prijs.pl_cc_0,prijs.foto,prijs.pr_qt_0,prijs.qt_cc_0,prijs.leverancie,prijs.partij,prijs.artikelcod,prijs.hoofdgroep,prijs.sleutelkod,prijs.s01_potmt,prijs.subgroep,prijs.s02_hmin,prijs.s54_plvorm,prijs.s04_brmin,prijs.pr_cc_0,prijs.pr__cc_0,s54.nederlands,s54.français,s54.english,s54.row_id from prijs as prijs, plantvormen as s54, artikellijst as om where prijs.bijgewerkt > '".$datum."' and prijs.bijgewerkt < '".$datum2."' and s54.row_id = prijs.s54_plvorm and prijs.artikelcod = om.productcod order by hoofdgroep,s01_potmt,s02_hmin,s04_brmin,pr_cc_0";
/* het resultaat opbouwen */
$query_result = mysql_query($requete_sql,$dbh);
/* vind ie iets? */
if (mysql_num_rows($query_result) > 0)
{
while($row = mysql_fetch_array($query_result))
{
$lev = $row["leverancie"];
$partij = $row["partij"];
$prodco = $row["artikelcod"];
$naam = $row["hoofdgroep"];
$naam2 = $row["om_français"];
$sleutel = $row["sleutelkod"];
$sub = $row["subgroep"];
$s01 = $row["s01_potmt"];
$s02 = $row["s02_hmin"];
$s04 = $row["s04_brmin"];
$s54 = $row["s54_plvorm"];
$prcc = $row["pr_cc_0"];
$prmcc = $row["pr__cc_0"];
$qt = $row["qt_cc_0"];
$prqt = $row["pr_qt_0"];
$plf = $row["p_f_0"];
$plcc = $row["pl_cc_0"];
$nl = $row["nederlands"];
$fr = $row["français"];
$en = $row["english"];
$foto = $row["foto"];
$photo = "http://www.pass-server.be/uploads/f".$row["sleutelkod"].".jpg";
$s05 = $row["s05_rijphd"];
$gk = $row["groepscode"];
$wk01 = $row[$wk1];
$wk02 = $row[$wk2];
$wk03 = $row[$wk3];
$wk04 = $row[$wk4];
$wk05 = $row[$wk5];
if ($wk01 === "X" || $wk02 === "X" || $wk03 === "X" || $wk04 === "X" || $wk05 === "X")
{
if ($naam <> $naam2)
{
$naam = $naam." - ".$naam2;
}
if (substr($gk,1,1) <> "1")
{
if ($s05 > "0")
{
switch ($s05)
{
case "1" :
$nl = "<font color='green'><B>GESLOTEN KNOP - </B></font>".$nl." || <font color='green'><B>BOUTON FERME - </B></font>".$fr." || <font color='green'><B>CLOSED BUTTONS - </B></font>".$en;
break;
case "2" :
$nl = "<font color='purple'><B>KLEURTONEND - </B></font>".$nl." || <font color='purple'><B>MONTRANT COULEUR - </B></font>".$fr." || <font color='purple'><B>SHOWING COLOURS - </B></font>".$en;
break;
case "3" :
$nl = "<font color='red'><B>OPEN BLOEMEN + KLEURTONENDE KNOP - </B></font>".$nl." || <font color='red'><B>FLEURS OUVERT + BOUTONS MONTRANT COULEUR - </B></font>".$fr." || <font color='red'><B>OPEN FLOWERS + BOTTONS SHOWING COLOR - </B></font>".$en;
break;
case "4" :
$nl = "<font color='blue'><B>VOLLEDIG IN BLOEI - </B></font>".$nl." || <font color='blue'><B>ENTIEREMENT EN FLEURAISSON - </B></font>".$fr." || <font color='blue'><B>ENTIRELY OPEN FLOWERS - </B></font>".$en;
break;
case "5" :
$nl = "ZONDER KNOP - ".$nl." || PAS DE BOUTONS - ".$fr." || NO BUTTONS - ".$en;
break;
}
}
else
{
$nl = $nl." - ".$fr." - ".$en;
}
}
if ($foto === "X")
{
$message .= '<TD ALIGN=LEFT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$naam.'</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$sub.'</a></font></B></TD>';
$message .= '<TD ALIGN=LEFT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$nl.'</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$s01.'</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$s02.'</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$s04.'</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$plf.'</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$plcc.'</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$prmcc.'</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$prcc.'</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$qt.' CC</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$prqt.'</a></font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2><a href='.$photo.' TARGET="_blank">'.$lev.'</a></font></B></TD></tr>';
}
else
{
$message .= '<TD ALIGN=LEFT><B><font size=2>'.$naam.'</font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$sub.'</font></B></TD>';
$message .= '<TD ALIGN=LEFT><B><font size=2>'.$nl.'</font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$s01.'</font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$s02.'</font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$s04.'</font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$plf.'</font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$plcc.'</font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$prmcc.'</font></b></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$prcc.'</font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$qt.' CC</font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$prqt.'</font></B></TD>';
$message .= '<TD ALIGN=RIGHT><B><font size=2>'.$lev.'</font></B></TD></tr>';
}
}
}
}
$message .= '
</table>
</body>
</html>
';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: [email protected]\r\n";
$headers .= "Reply-To: [email protected]\r\n";
$headers .= "Return-Receipt-To: [email protected]\r\n";
while($koper2 < 4000)
{
$requete_sql = "select naam,email from plant.test where row_id > $koper1 and row_id < $koper2";
$update = "De updates van $datum waren gevonden en de laatste verstuurd om ".date('H:i:s');
/* het resultaat opbouwen */
$query_result = mysql_query($requete_sql,$dbh);
/* vind ie iets? */
/*$to = "[email protected],";*/
if (mysql_num_rows($query_result) > 0)
{
/* en nu echot ie de info in de db die bij die rij hoort die gekozen is */
while($row = mysql_fetch_array($query_result))
{
set_time_limit(9000);
$eign = $row["naam"];
$eignem = $row["email"];
$to = $eignem;
mail("[email protected]",$subject,$message,$headers);
echo "koper ".$eign." heeft de mail ontvangen hij was de ".$koper." mail die verstuurd was<br>";
$koper = $koper+1;
}
$koper = 1;
}
$koper1 = $koper1+10;
$koper2 = $koper2+10;
}
echo $to;
echo "De updates zijn verzonden";
mail("[email protected]","De updates zijn verwerkt",$update);
}
?>
</body>
</html>
------------------------------------------------------------
1.430 views