| 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/mommybites/automation/ |
Upload File : |
#!/usr/local/bin/php
<?php
echo "START\n"; // TESTING
/**
* Reminder email that gets sent out to mom job posters 1 day prior to expiration
*/
/**
* set script params
*/
$live = true; // null | true; note: null = test mode and will select more records and send to test addresses
$renewalUrl = 'https://mommybites.com/newyork/work-for-moms/post-job/'; // updated dynamically below
$subject = 'Mommybites Reminder - your job post has expired';
$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("-31 days");
$before_day = date('Y-m-d', $before);
$after = strtotime("-60 days");
$after_day = date('Y-m-d', $after);
$query = "SELECT * FROM mom_job_post
WHERE approved_date
BETWEEN '$after_day' AND '$before_day'
AND status = 'approved'
AND is_deleted != 'yes' and is_deleted != 'Y'" ;
} else {
$query = "SELECT * FROM mom_job_post
WHERE poster_email IN ('[email protected]')
AND blog_id > 1 AND (is_deleted = 'no' OR is_deleted='N') ORDER BY created_date DESC LIMIT 1" ; // TESTING
echo "<br>$query<br>";
}
$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';
$subject = 'Mommybites Reminder - your job post has expired';
$renewalUrl = 'https://mommybites.com/newyork/work-for-moms/post-job/';
// $sponsorAdSrc = 'http://mommybites.com/newyork/wp-content/blogs.dir/2/files/2014/03/urbansitter_logo_160x160.png';
$sponsorAdAlt = 'Urban Sitter';
$sponsorAdUrl = 'https://www.urbansitter.com/promo/mommybites/?utm_source=mommybites&utm_medium=email_paid&utm_campaign=parent&utm_content=promo_25';
$sponsorAdText = '<p>During your nanny transition, you might need a little extra childcare help. Check out <a href="' . $sponsorAdUrl . '">UrbanSitter</a> for last-minute babysitters, back up childcare, or the occasional date night sitter. Simply search by date and time, schedule jobs, and even pay online--it\'s quick, easy and efficient to find reliable, mom-recommended babysitters. Try it for free: Enjoy your first month of Premium membership for free ($25 value) when you enter discount code: MOMMYBITES25 and upgrade by July 31.*</p>';
$sponsorAdText .= '<p>Sign up and redeem your discount now at <a href="' . $sponsorAdUrl . '">urbansitter.com/promo/mommybites</a></p>';
$sponsorAdText .= '<p>*Subject to UrbanSitter, Inc.\'s Terms of Service. $25 credit may be used toward Premium membership purchase. Not valid for babysitting fees. Recipient must become a registered user of UrbanSitter with valid credit card on file to redeem offer. Restrictions include sitter availability and service to requested location (not all areas served). UrbanSitter reserves the right to modify these terms. Must redeem by 7/31/2014</p>';
unset($sponsorAdSrc); // ******* Uncomment to REMOVE AD ********
break;
case '5': // boston
$from_email = '[email protected]';
$from_name = 'mommybites';
$reply_email = '[email protected]';
$reply_name = 'mommybites';
$headers .= 'From: mommybites <[email protected]>' . "\n" . 'Reply-To: mommybites <[email protected]>' . "\n";
$renewalUrl = 'https://mommybites.com/boston/work-for-moms/post-job/';
break;
}
// create message
$message = '';
$message .= 'Dear ' . $arrRow['poster_name'] . ',';
$message .= '<br /><br />Your job posting on the mommybites Job board has expired. If you have 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 $25 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 job.';
$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 = '[email protected]'; //PHPM_DEV_TO;
$subject .= ' - TEST';
//echo $message . "\n\n"; // TESTING
}
echo "sending to: $mail_to<br>";
$message = '<html><head></head><body>'.$message.'</body></html>';
sendSimpleEmail($mail_to,'[email protected]',$subject,$message);
}
echo "DONE\n";
exit();
?>