function get_user($login, $password = "", $set_as_current_user = false) { if ($password == "") { $result = db_query("select * from `users` where login='******'", $login); } else { $result = db_query("select * from `users` where login='******' and password='******'", $login, md5($password)); } if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); foreach ($row as $key => $val) { if ($key != 'password') { $user[$key] = $val; } } if ($set_as_current_user) { $user['emails'] = get_emails($user['uid']); set_current_user($user); } return $user; } else { return false; } }
<br> <p>Best wishes,<br>The HiveBot™</p> </body> </html> '; mail($to, "Film Night Voting", $message, "Content-type:text/html"); $webPush = new WebPush(array('GCM' => $push_api)); $endpoints = get_endpoints("Voting_End30"); // send multiple notifications foreach ($endpoints as $endpoint) { $webPush->sendNotification($endpoint['Endpoint']); } $webPush->flush(); } if (in_array("Voting_End", get_event(3600))) { $to = get_emails("Voting_End60"); $message = ' <html> <body> <p>Dear HiveMember,</p> <p>You are yet to vote for this weeks film night. Voting closes in an hour. <p>Please <a href="https://films.jakestockwin.co.uk/voting.php">click here</a> to vote</p> <br> <p>Best wishes,<br>The HiveBot™</p> </body> </html> '; mail($to, "Film Night Voting", $message, "Content-type:text/html"); $webPush = new WebPush(array('GCM' => $push_api)); $endpoints = get_endpoints("Voting_End60"); // send multiple notifications
$privilege_root_path = "/admin"; require_once "includes/include_all_fns.inc"; session_start(); // extract ( $_SESSION , EXTR_REFS ) ; $err_message = " Unable to process your request due to the following problems: <br>\n"; //Code added to address security problem reported by Sebastian Held 14-Nov-2006 $header = "Bulk Email"; $accepted_privilegeID_arr = array(3 => ""); $accepted_phaseID_arr = array(1 => "", 2 => "", 3 => "", 4 => ""); authentication($header, $accepted_privilegeID_arr, $accepted_phaseID_arr, $homepage, $php_root_path, $GLOBALS["DB_PREFIX"], &$err_message); $arrEmailInfo =& $_SESSION["arrEmailInfo"]; $arrAttachmentInfo =& $_SESSION["arrAttachmentInfo"]; //Call the function to get the conference information $conferenceInfo = get_conference_info(); if ($_POST["Submit"] == "Confirm") { $arrEmails = get_emails($arrEmailInfo["to"]); //Create the instance of mail $mail = new Mail(); $mail->Organization($conferenceInfo->ConferenceCodeName); $mail->ReplyTo($conferenceInfo->ConferenceContact); $mail->From("*****@*****.**"); // $mail -> To($arrEmails); $mail->To("*****@*****.**"); $mail->Subject(stripslashes(trim($arrEmailInfo["subject"]))); $mail->Body(stripslashes(trim($arrEmailInfo["content"]))); if ($arrEmailInfo["cc"] != "") { $mail->Cc($arrEmailInfo["cc"]); } if ($arrEmailInfo["bcc"] != "") { $mail->Bcc($arrEmailInfo["bcc"]); }
?> ',null,'height=700,width=700,status=yes,toolbar=no,menubar=no,scrollbars=yes,location=no');"><!--<a href="mailing_list.php?to=<?php //echo $_POST["to"]; ?> " target="_blank">-->Customize Recipients Addresses</a></td> </tr> <tr> <td valign="top"> </td> <td> </td> </tr> <tr> <td valign="top">Recipients Emails:</td> <td> <?php $arrEmails = get_emails($_POST["to"]); for ($i = 0; $i < count($arrEmails); $i++) { if ($i == count($arrEmails) - 1) { echo $arrEmails[$i]; } else { echo $arrEmails[$i] . ", "; } } ?> </td> </tr> <?php if ($_POST["cc"] != "") { ?> <tr> <td> </td>
echo "Task log:\n {$log}\n"; } function get_emails($token, $project_id) { //initializing iron_mq $ironmq = new IronMQ(array('token' => $token, 'project_id' => $project_id)); //getting 100 messages from iron_mq $messages = $ironmq->getMessages('mail', 100); $emails = array(); foreach ($messages as $message) { //adding message body to list of emails $emails[] = $message->body; //deleting message from queue $ironmq->deleteMessage('mail', $message->id); } return $emails; } $payload = getPayload(); //getting list of emails to send from iron_mq $emails = get_emails($payload->token, $payload->project_id); echo "List of emails"; print_r($emails); if (!empty($emails)) { //split array into small arrays with max 10 elems per each $chunked_list = array_chunk($emails, 10); foreach ($chunked_list as $email) { //queueing worker for each array queue_worker($payload, $emails); } } echo "Worker is done";