Quote
grr wrote:
Wrong but.
<?php
$result = dbquery("SELECT * FROM ".$db_prefix."newsletter_subs");
$remove_count = 0;
while ($a = dbarray($result))
{
$entry_id = $a['newsletter_sub_user'];
$checkresult = dbquery("SELECT user_name FROM ".$db_prefix."users WHERE user_id=".$entry_id);
$checkrows = dbrows($checkresult);
if ($checkrows == 0)
{
dbquery("DELETE FROM ".$db_prefix."newsletter_subs WHERE newsletter_sub_user=".$entry_id);
$remove_count++;
}
}
echo "<br><center><b>Removed ".$remove_count." undead users from the database.</b></center><br>";
?>
$result = dbquery(
"SELECT tns.*, tu.user_id,user_name,user_email FROM ".$db_prefix."newsletter_subs tns
LEFT JOIN ".$db_prefix."users tu ON tns.newsletter_sub_user=tu.user_id"
);
if (dbrows($result)) {
$i = 1; $rows = dbrows($result); $bcc_list = "";
while ($data = dbarray($result)) {
$bcc_list .= ($i != 1 ? ", " : "").$data['user_email'];
if ($rows == 1 || $i == 99) {
if (!sendemail($settings['siteusername'],$settings['siteemail'],$settings['siteusername'],$settings['siteemail'],$subject,$content,$_POST['format'],"", $bcc_list)) {
$error = $locale['nl418'];
}
$bcc_list = "";
}
if ($i != 99) { $i++; } else { $i = 1; }
$rows--;
}
} else {
$error = $locale['nl419'];
}
sendemail($settings['siteusername'],$settings['siteemail'],$settings['siteusername'],$settings['siteemail'],$subject,$content,$_POST['format'],"", $bcc_list)
if ($rows == 1 || $i == 99) {
if (!sendemail($settings['siteusername'],$settings['siteemail'],$settings['siteusername'],$settings['siteemail'],$subject,$content,$_POST['format'],"", $bcc_list)) {
$error = $locale['nl418'];
}
$bcc_list = "";
}
if ($i != 99) { $i++; } else { $i = 1; }
$rows--;
}
if ($rows == 1 || $i == 800) {
if (!sendemail($settings['siteusername'],$settings['siteemail'],$settings['siteusername'],$settings['siteemail'],$subject,$content,$_POST['format'],"", $bcc_list)) {
$error = $locale['nl418'];
}
$bcc_list = "";
}
if ($i != 800) { $i++; } else { $i = 1; }
$rows--;
}
$result = dbquery(
"SELECT tns.*, tu.user_id,user_name,user_email FROM ".$db_prefix."newsletter_subs tns
LEFT JOIN ".$db_prefix."users tu ON tns.newsletter_sub_user=tu.user_id"
);
if (dbrows($result)) {
$i = 1; $rows = dbrows($result); $bcc_list = "";
$primary_email = $settings['siteemail'];
$primary_to_name = $settings['siteusername'];
while ($data = dbarray($result)) {
if ($primary_email == "")
{
$primary_email = $data['user_email'];
$primary_to_name = $data['user_email'];
}
else
{
$bcc_list .= ($i != 1 ? ", " : "").$data['user_email'];
}
if ($rows == 1 || $i == 99) {
if (!sendemail($primary_to_name,$primary_email,$settings['siteusername'],$settings['siteemail'],$subject,$content,$_POST['format'],"", $bcc_list)) {
$error = $locale['nl418'];
}
$bcc_list = "";
$primary_to_name = "";
$primary_email = "";
}
if ($i != 99) { $i++; } else { $i = 1; }
$rows--;
}
} else {
$error = $locale['nl419'];
}
Category Forum
Official Core Support - 6Labels
None yet
Statistics
0 participants
Notifications
You are not receiving notifications from this thread.
Related Questions