Hello allen,
Ik verstuur 'n nieuwsbrief naar alle personen in de db, die krijgen hem dus da's ok.
De afmeldlink werkt niét correct : er wordt nochthans een variabele ID meegegeven in de db bij ingave van de naam en emailadres maar wanneer ik de mail verstuur en in de code kijk van de - in outlook - gearriveerde nieuwsbrief zie ik dat de afmeldlink telkens klaarstaat om de ID van de eerste record in de databank te verwijderen.
Als ik op de link druk, tjah...dan verwijdert hij deze ook : dus niét de ID van de specifieke persoon die de mail heeft ontvangen...
Wat doe ik mis ?
alvast bedankt !
code mail versturen :
<?php
include('../connect.php');
$bericht = Stripslashes($_POST['content']);
$onderwerp = Stripslashes($_POST['onderwerp']);
$tekst = "
<html>
$bericht
</html>" ;
$query = "SELECT DISTINCT email FROM `mailing`";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$headers = "From: $van_naam<$van_email>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($row['email'], $onderwerp, $tekst, $headers);
};
echo "<font face='haettenschweiler'><center>verzonden!</center></font>";
?>
code verwerken van delete :
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
if ((isset($_GET['DELETE'])) && ($_GET['DELETE'] != "")) {
$deleteSQL = sprintf("DELETE FROM mailing WHERE ID=%s",
GetSQLValueString($_GET['DELETE'], "int"));
mysql_select_db($database_tutorial, $tutorial);
$Result1 = mysql_query($deleteSQL, $tutorial) or die(mysql_error());
$deleteGoTo = "gedaan.html";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
mysql_select_db($database_tutorial, $tutorial);
$query_Recordset1 = "SELECT * FROM mailing";
$Recordset1 = mysql_query($query_Recordset1, $tutorial) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_free_result($Recordset1);
?>
code nieuwsbrief :
?php
mysql_select_db($database_tutorial, $tutorial);
$query_Recordset1 = "SELECT * FROM mailing";
$Recordset1 = mysql_query($query_Recordset1, $tutorial) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!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=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<p>nieuwsbrief.</p>
<p> </p>
<p><a href="http://www.f-inject.be/apps/newsletter/nieuwsbrief3/admin/verwerk_delete.php?DELETE=<?php echo $row_Recordset1['ID']; ?>">uitschrijven ? </a></p>
</body>
</html>
<?php
mysql_free_result($Re
1.419 views