"; if ($_SESSION['isAdmin'] !== true) return; $userID = $_SESSION['userID'] * 1; if (!is_int($userID)) return; //lol because I tink dis is cool... echo "Validated permissions...
"; $data = $_POST; //Sanitize $selections = $_POST['selections']; foreach ($selections as $selectedID=>&$value) { $value = intval($selectedID); if (!is_int($selectedID)) die("Sanitization of userID's failed"); } $in = implode(',', $selections); $sql = "SELECT `id`, `displayName`, `dateJoined`, `dateLogin`, `email` FROM `users` WHERE `ID` IN ( $in ) "; echo "SQL: $sql
"; $result = mysql_query($sql) or die(mysql_error()); while (list($tmpID, $tmpDisplay, $tmpJoined, $tmpLastLogon, $tmpEmail) = mysql_fetch_row($result)) { //Replacements are done in order; $replacements = array( '%footer' => $emailFooter, '%display' => $tmpDisplay, '%id' => $tmpID, '%email' => $tmpEmail, '%mydomain' => $mydomain, '%joined' => relative_date(strtotime($tmpJoined)), '%lastLogin' => relative_date(strtotime($tmpLastLogon)) ); $tmpBody = stripslashes($_POST['body']); $tmpTitle = stripslashes($_POST['title']); $tmpBody = replaceByArray($tmpBody, $replacements); $tmpTitle = replaceByArray($tmpTitle, $replacements); echo "$tmpBody
"; //This Sanitizes data - so no worries! QueueEmail(null, $tmpEmail, $tmpTitle, $tmpBody, 100); } echo "Complete!...
"; DoRedirect("Emails processed!"); exit; } $res = mysqli_query($mysqli, "SELECT count(*) as count FROM `emailQueue`"); $row = mysqli_fetch_assoc($res); $count = $row['count']; //QueueEmail(3, "snapwilliam@gmail.com", "hi,testing", "this is a body", 20, true); //echo "
QUEUED!
"; //$time_start = microtime(true); //Loop It // for ($i = 1; $i <= 10000; $i++) { // SendQueuedEmail(); // } //$time_end = microtime(true); //$time = $time_end - $time_start; //echo "
Script execution: $time seconds XX\n
"; $where = ''; if (isset($_POST['selectResultSet']) AND $_POST['selectResultSet'] == 'true') { // CLAUSES: $clause1 = $_POST['clause1']; $clauseOptions = array('ID', 'displayName', 'dateJoined', 'dateLogin', 'email', 'isAdmin'); if (!in_array($clause1, $clauseOptions)) die("clause1 fail"); $operatorOptions = array('LessThan' => '<', 'GreaterThan' => '>', 'EqualTo' => '='); $operator1 = $operatorOptions[$_POST['operator1']]; $value1 = mysql_escape_string($_POST['value1']); $where = "AND $clause1 $operator1 '$value1'"; } $sql = "SELECT `ID`, `displayName`, `dateJoined`, `dateLogin`, `email`, `isAdmin` FROM `users` WHERE `isOptedOutOfEmails` = '0' $where "; $result = mysql_query($sql); ?>

Mass Email

There are emails in emailQueue.

Modify the WHERE clause first to get the users you want selected.

Varriables available

WHERE IS TO


Email to send Title:

Sends emails to all selected users.

RESULT SET

WHERE `isOptedOutOfEmails` = '0'

"; htmlFooter(); function displayUserResultSet($result) { $r = " "; $i = 0; while (list($CUID, $CUsername, $Joined, $LastLogon, $email, $isAdmin) = mysql_fetch_row($result)) { $i++; //$Joined = Date("d/m/y - g:ia", $Joined); $Joined = strtotime($Joined); //$Joined = relative_date($Joined); $Joined = date("Y-m-d", $Joined); $LastLogon = strtotime($LastLogon); //$LastLogon = relative_date($LastLogon); $LastLogon = date("Y-m-d", $LastLogon); if ($isAdmin == 1) $isAdmin = "Yes"; else $isAdmin = "No"; $r .= ""; } $r .= "
IDDisplay name:Joined On:Last LogonEmailAdministrator
$CUID $CUsername $Joined $LastLogon $email $isAdmin


"; $r = "

$i Users Returned

$r"; return $r; } function replaceByArray($text, $replacements) { foreach ($replacements as $search=>$replace) { $text = str_replace($search, $replace, $text); } return $text; } //Thank you: //http://snippets.dzone.com/posts/show/196 function relative_date($time) { $today = strtotime(date('M j, Y')); $reldays = ($time - $today)/86400; if ($reldays >= 0 && $reldays < 1) { return 'Today'; } else if ($reldays >= 1 && $reldays < 2) { return 'Tomorrow'; } else if ($reldays >= -1 && $reldays < 0) { return 'Yesterday'; } if (abs($reldays) < 7) { if ($reldays > 0) { $reldays = floor($reldays); return 'in ' . $reldays . ' day' . ($reldays != 1 ? 's' : ''); } else { $reldays = abs(floor($reldays)); return $reldays . ' day' . ($reldays != 1 ? 's' : '') . ' ago'; } } if (abs($reldays) < 182) { return date('l, F j',$time ? $time : time()); } else { return date('l, F j, Y',$time ? $time : time()); } } ?>