| Server IP : 104.21.21.239 / Your IP : 216.73.216.68 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/hotel-prod/public_html/rpt/ |
Upload File : |
<?php include('mod/_mod_security.php'); ?>
<?php
$sql = "SELECT e.event_date_time, e.event_name, c.first_name, c.last_name, ec.nbr_of_guests, h.hotel_name ".
", CAST(IFNULL((SELECT SUM(nbr_of_guests) FROM events_concierges ecr WHERE ecr.event_id = e.event_id AND ecr.rsvp_1 = 1), 0) AS SIGNED) AS nbr_of_guests_rsvp_venue1 ".
", CAST(IFNULL((SELECT SUM(nbr_of_guests) FROM events_concierges ecr WHERE ecr.event_id = e.event_id AND ecr.conf_1 = 1), 0) AS SIGNED) AS nbr_of_guests_conf_venue1 ".
"FROM events e ".
"LEFT JOIN events_concierges ec ON (e.event_id = ec.event_id AND ec.rsvp_1 = 1) ".
"LEFT JOIN concierges c ON (ec.concierge_id = c.concierge_id) ".
"LEFT JOIN hotels h ON (h.hotel_id = c.hotel_id) ".
//"WHERE e.event_date_time >= CURDATE() AND e.event_date_time < DATE_ADD(CURDATE(), INTERVAL 15 DAY) ".
"WHERE e.event_date_time >= CURDATE() ".
"AND CAST(IFNULL((SELECT SUM(nbr_of_guests) FROM events_concierges ecr WHERE ecr.event_id = e.event_id AND ecr.conf_1 = 1), 0) AS SIGNED) = 0 ".
"UNION ALL ".
"SELECT e.event_date_time, e.event_name, c.first_name, c.last_name, ec.nbr_of_guests, h.hotel_name ".
", CAST(IFNULL((SELECT SUM(nbr_of_guests) FROM events_concierges ecr WHERE ecr.event_id = e.event_id AND ecr.rsvp_1 = 1), 0) AS SIGNED) AS nbr_of_guests_rsvp_venue1 ".
", CAST(IFNULL((SELECT SUM(nbr_of_guests) FROM events_concierges ecr WHERE ecr.event_id = e.event_id AND ecr.conf_1 = 1), 0) AS SIGNED) AS nbr_of_guests_conf_venue1 ".
"FROM events e ".
"LEFT JOIN events_concierges ec ON (e.event_id = ec.event_id AND ec.conf_1 = 1) ".
"LEFT JOIN concierges c ON (ec.concierge_id = c.concierge_id) ".
"LEFT JOIN hotels h ON (h.hotel_id = c.hotel_id) ".
//"WHERE e.event_date_time >= CURDATE() AND e.event_date_time < DATE_ADD(CURDATE(), INTERVAL 15 DAY) ".
"WHERE e.event_date_time >= CURDATE() ".
"AND CAST(IFNULL((SELECT SUM(nbr_of_guests) FROM events_concierges ecr WHERE ecr.event_id = e.event_id AND ecr.conf_1 = 1), 0) AS SIGNED) > 0 ".
"ORDER BY event_date_time ASC, event_name ASC, first_name ASC, last_name ASC";
//echo " === ".$sql." === ";
//error_log(" === ".$sql." === ");
//echo ' Records: '.$result->rowCount();
if ($_GET['fmt'] == 'excel') :
$file_name = APP_REPORT_OPTIONS['upcoming_events']['temp_dir'].'upcoming_events_'.date('Y_m_d_H_i_s').'.'.APP_EXCEL_FORMAT;
if (sql_to_xls($sql, $file_name) > 0):
//***************** mail using PHPMailer *****************
$mail = new PHPMailer\PHPMailer\PHPMailer();
//$mail->SMTPDebug = 3; // Enable verbose debug output 1-4
$mail->isSMTP();
$mail->Host = APP_MAIL_SMTP; // get_cfg_var('SMTP')
$mail->SMTPAuth = APP_MAIL_SMTP_AUTH; // false
$mail->Username = APP_MAIL_SMTP_USERNAME; // ''
$mail->Password = APP_MAIL_SMTP_PASSWORD; // ''
$mail->SMTPSecure = APP_MAIL_SMTP_SECURE; // 'tls' or 'ssl'
$mail->Port = APP_MAIL_SMTP_PORT; // get_cfg_var(smtp_port) 587 for secure
$mail->SMTPOptions = APP_MAIL_SMTP_OPTIONS;
$mail->setFrom(APP_MAIL_FROM);
$ar_to = array_map('trim', explode(',', APP_REPORT_OPTIONS['upcoming_events']['mail_to']));
foreach ($ar_to as $value) :
$mail->addAddress($value);
endforeach;
//$mail->addAddress('[email protected]');
//$mail->addReplyTo('[email protected]', 'Information');
//$mail->addCC('[email protected]');
if (!empty(APP_MAIL_BCC)) :
$mail->addBCC(APP_MAIL_BCC);
endif;
$mail->addAttachment($file_name);
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');
$mail->isHTML(true);
$mail->Subject = 'Upcoming Concierge Event Info';
$mail_body = '<html><head>'.
'<style>body {font-family:Arial, Helvetica, sans-serif; font-size:14px;} table {font-size:14px;}</style>'.
'</head><body>'.
'Hi Everyone,<br><br>'.
'Attached are the upcoming events for the next couple of weeks. The reports contain how many are attending and who RSVPD.<br><br>'.
'Any questions, please feel free to reach out to me.<br><br>'.
'Thank You, <br>'.
'Rebecca<br>'.
'</body></html>';
$mail->Body = $mail_body;
$mail_body_plain = str_ireplace('</p>', "\n\r", $mail_body);
$mail_body_plain = str_ireplace('<br>', "\n\r", $mail_body_plain);
$mail_body_plain = str_ireplace('<br />', "\n\r", $mail_body_plain);
$mail->AltBody = strip_tags($mail_body_plain);
if(!$mail->send()) :
echo '<p>Message could not be sent.</p>';
echo '<p>Mailer Error: '.$mail->ErrorInfo.'</p>';
write_log('E', 0, 'Error sending mail - '.$_GET['IX'].' - '.$mail->ErrorInfo);
//else :
//echo '<p>Message has been sent</p>';
endif;
//**** ************************** *****
endif;
endif;
?>