| Server IP : 104.21.21.239 / Your IP : 216.73.216.11 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/home2/mommydevsara/davler-mommybites/automation/ |
Upload File : |
#!/usr/local/bin/php
<?php
echo "START\n"; // TESTING
date_default_timezone_set('America/Los_Angeles');
/**
* set script params
*/
$live = true; // null | true; note: null = test mode and will select more records and send to test addresses
$renewalUrl = 'http://mommybites.com/newyork/child-care/nanny-post/'; // updated dynamically below
$subject = 'Mommybites Reminder - your nanny share post is about to expire';
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
if(!$live){
echo "testing";
}
/**
* connect to server
*/
require_once($_SERVER['DOCUMENT_ROOT'].'/wp-config.php');
$conn = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
if (!$conn){
die('mysqli error (' . mysqli_errno($conn) . ' - ' . mysqli_error($conn) . ')');
}
mysqli_set_charset($conn, "UTF8");
/**
* define/execute query
*/
if($live){
$before = strtotime("-28 days");
$before_day = date('Y-m-d', $before);
$after = strtotime("-29 days");
$after_day = date('Y-m-d', $after);
$query = "SELECT * FROM nanny_share_post
WHERE approved_date
BETWEEN '$after_day' AND '$before_day'
AND status = 'approved'
AND is_deleted = 'N'" ;
} else {
$query = "SELECT * FROM nanny_share_post
WHERE poster_email IN ('[email protected]', '[email protected]')
AND blog_id IN (2, 5, 6) AND is_deleted = 'N' ORDER BY created_date DESC LIMIT 5" ; // TESTING
}
$result = mysqli_query($conn, $query);
if (!$result){
die('mysqli error (' . mysqli_errno($conn) . ' - ' . mysqli_error($conn) . ')');
}
/**
* send emails
*/
while($arrRow = mysqli_fetch_array($result) ){
switch($arrRow['blog_id']){
case '2': // new york
$from_email = '[email protected]';
$from_name = 'mommybites';
$reply_email = '[email protected]';
$reply_name = 'mommybites';
$renewalUrl = 'https://mommybites.com/newyork/child-care/nanny-share-form/';
$sponsorAdSrc = 'http://mommybites.com/newyork/wp-content/blogs.dir/2/files/2013/03/EllasKitchen_160X160.jpg';
$sponsorAdAlt = 'Ella\'s Kitchen';
$sponsorAdUrl = 'http://ellaskitchen.com';
$sponsorAdText = 'At <a href="' . $sponsorAdUrl . '">Ella\'s Kitchen</a>, we want to help kids enjoy healthy food, so they grow up knowing that it can be tasty, fun and cool. That\'s why we make sure that all our yummy 100% organic food appeals to all their senses. Plus, our packs are perfect for little hands to grab and they sit snugly in your bag when you\'re out and about!<br/><br/><a href="' . $sponsorAdUrl . '">ellaskitchen.com</a>';
unset($sponsorAdSrc); // ******* Uncomment to REMOVE AD ********
break;
case '5': // boston
$from_email = '[email protected]';
$from_name = 'mommybites';
$reply_email = '[email protected]';
$reply_name = 'mommybites';
$renewalUrl = 'https://mommybites.com/boston/child-care/nanny-share-form/';
break;
case '6': // chicago
$from_email = '[email protected]';
$from_name = 'mommybites';
$reply_email = '[email protected]';
$reply_name = 'mommybites';
$renewalUrl = 'https://mommybites.com/chicago/child-care/nanny-share-form/';
break;
}
// create message
$message = '';
$message .= 'Dear ' . $arrRow['poster_name'] . ',';
$message .= '<br/><br/>Your nanny share posting on the mommybites nanny board is about to expire. If she has not yet found a job and you would like to renew your posting for another month, please click here: <a href="'.$renewalUrl.'?hashid=' . $arrRow['hash'] . '-' . $arrRow['id'].'">'.$renewalUrl.'?hashid=' . $arrRow['hash'] . '-' . $arrRow['id'] . '</a>. You can either remit $85 for the identical posting or you can make changes to any of the information before you remit payment. Thank you once again for using the resources of www.mommybites.com in the search for a new position for your nanny.';
$message .= '<br/><br/>Sincerely,<br/>The Mommybites Staff';
// ad section
if( isset($sponsorAdSrc) ) {
$message .= '<br/><br/><table border="0"><tr valign="top">';
$message .= '<td><a href="' . $sponsorAdUrl . '"><img src="' . $sponsorAdSrc . '" border="0" alt="' . $sponsorAdAlt . '"></a></td>';
$message .= '<td>' . $sponsorAdText . '</td>';
$message .= '</tr></table>';
}
// email message
require_once($_SERVER['DOCUMENT_ROOT'].'/php_mailer_config.php');
if($live){ // email message
$arBCC = PHPM_BCC;
$arCC = [];
$mail_to = $arrRow['poster_email'];
} else {
$arBCC = PHPM_DEV_BCC;
$arCC = [];
$mail_to = PHPM_DEV_TO;
$subject .= ' - TEST';
echo $message . "\n\n"; // TESTING
echo $query;
}
$message = '<html><head></head><body>'.$message.'</body></html>';
sendSimpleEmail($mail_to,'[email protected]',$subject,$message);
}
echo "DONE\n";
exit();
?>