<?php
/**********************************************************
* ______ ______ ___ _______ ___ ___ _______ *
* | _ \ | _ \ | | | _ || Y || _ | *
* |. | \|. | \|. | |. 1___||. || 1___| *
* |. | |. | |. |___ |. |___ |. \_/ ||____ | *
* |: 1 |: 1 |: 1 ||: 1 ||: | ||: 1 | *
* |::.. . /|::.. . /|::.. . ||::.. . ||::.|:. ||::.. . | *
* `------' `------' `-------'`-------'`--- ---'`-------' *
* _______ _______ *
* .--.--. | _ | | | *
* | | | |___| | __ |___| | *
* \___/ _(__ | |__| / ___/ *
* |: 1 | |: 1 \ *
* |::.. . | |::.. . | *
* `-------' `-------' *
* *
* Script: DDLCMS v3.2 *
* Author: Little Dragon *
* Email: hide@address.com *
* Website: http://www.ddlcms.com *
* *
* Please direct bug reports, suggestions or feedback *
* to the DDLCMS forums: *
* *
* http://www.ddlcms.com/forums *
* *
* DDLCMS is a commercial grade content management *
* system for DDL site owners. It is provided free *
* of charge, provided: *
* *
* 1. You keep the linkback to http://www.ddlcms.com *
* in the footer. *
* *
* 2. You keep the sponsored links to Sharingzone.net *
* on your site. *
* *
* By using this script, you agree that you will not *
* modify, remove, or replace any encoded parts of *
* this script. All encoded parts MUST remain intact *
* for your site to remain in good standing. *
* *
**********************************************************/
class email extends config
{
function fetch()
{
global $m, $emails, $pagelimit;
$emails = array();
if(isset($_GET) && is_array($_GET) && count($_GET) > 0 && array_key_exists('page', $_GET) && ctype_digit($_GET['page']))
{
$page = $_GET['page'];
}
else
{
$page = 1;
}
$this->page = $page;
$this->page *= $pagelimit;
$this->page -= $pagelimit;
$g_total = dbcom('SELECT COUNT(email) AS totalEmails FROM (SELECT DISTINCT email FROM ((SELECT DISTINCT email FROM downloads WHERE email != "") UNION (SELECT DISTINCT email from instantle where email != "") UNION (SELECT DISTINCT Email AS email FROM topsites_Accounts WHERE Email != "")) AS theTable ORDER BY email) AS emailTally;');
$this->total = mysql_result($g_total, 0);
$get = dbcom("SELECT DISTINCT email FROM ((SELECT DISTINCT email FROM downloads WHERE email != '') UNION (SELECT DISTINCT email from instantle where email != '') UNION (SELECT DISTINCT Email AS email FROM topsites_Accounts WHERE Email != '')) AS theTable ORDER BY email LIMIT $this->page, $pagelimit;");
$a = array();
while ($row = mysql_fetch_array($get))
{
if (!in_array($row[email], $emails))
{
if(testEmail($row[email]))
{
$emails[] = strtolower(trim($row[email]));
}
}
}
}
function listemails() {
global $m, $emails;
$this->fetch();
echo "<h2>Webmaster Email List</h2><P>Email addresses from submitters, toplist members, and instant link exchange members.<br>" . $this->total . " email addresses listed in alphabetical order.
<P><table border=0 cellpadding=0 cellspacing=0 width=\"100%\"><tr>";
for ($i=0; $i<count($emails); $i++) {
echo "<td width=\"33%\">".$emails[$i]."</td>";
if (is_int(($i+1)/3)) echo "</tr><tr>";
}
echo "</tr></table><br><br>";
$this->paginate('ddl.php?go=mailinglist&page=');
}
function send() {
global $_POST, $emails, $admin_email, $num_emails;
$this->fetch();
if(isset($_POST) && is_array($_POST) && count($_POST) > 0 && checkPostForm('sendNewsletter', $_POST) === TRUE)
{
$headers = "FROM: ".$admin_email."\n";
$headers .= "X-Sender: ".$admin_email."\n";
$headers .= "X-Mailer: DDLCMS.com DDL Warez Script\n";
$headers .= "X-Priority: 1\n";
$headers .= "Return-Path: ".$admin_email."\n";
$headers .= "bcc: ";
for ($i=0; $i<count($emails); $i++) {
$headers .= $emails[$i];
if ($i != count($emails)-1)
$headers .= ", ";
}
if(@mail($admin_email, $_POST['subject'], $_POST['message'], $headers))
{
echo '<b>Message Sent!</b><br><br>';
}
else
{
echo '<b><font color=red>Failed to send message!</font></b><br><br>';
}
}
else
{
echo "<h2>Send Newsletter</h2><P>
<form action=\"$site_url/admin/ddl.php?go=email\" method=\"post\">
Subject:<br>
<input type=\"text\" name=\"subject\" size=\"80\" class=\"form\">
<br><br>
Message:<br>
<textarea id='textarea' rows=60 cols=80 class=\"form\" name=\"message\">
</textarea>
<script type=\"text/javascript\">
generate_wysiwyg('textarea');
</script>
<br><br><input type=\"submit\" value=\"Send Newsletter\" class=\"formbuttonwide\">
</form>";
}
}
}
?>