session_start(); set_include_path(dirname(__FILE__) . '/../lib' . PATH_SEPARATOR . dirname(__FILE__) . '/../lib/rb/' . PATH_SEPARATOR . get_include_path()); include_once 'rb.php'; include_once 'db.php'; $one = strtotime("+2 day"); $two = strtotime("+3 day"); $today = strtotime(date('Y-m-d')); $subscribers = R::getAll('select * from subscription where expire_date >= :one and expire_date <= :two', array(':one' => $one, ':two' => $two)); $renewal = R::getAll('select * from subscription where expire_date <= :today', array(':today' => $today)); $airtel = array('234802', '234708', '234808', '234812'); $airtel2 = array('+234802', '+234708', '+234808', '+234812'); #2days reminder foreach ($subscribers as $subscriber) { if (array_search(substr($subscriber['user_phone'], 0, 6), $airtel) || array_search(substr($subscriber['user_phone'], 0, 7), $airtel2)) { $msg = "Dear subscriber, your mhealth weekly subscription expires on " . date('d-M-Y', strtotime("+2 day")) . " and #50 will be charged, to disable auto renewal please Dial *776#"; smsSender4(checkDestination($subscriber['user_phone']), $msg); } } #expire renewal /*foreach ($renewal as $subscriber) { if (array_search(substr($subscriber['user_phone'], 0, 6), $airtel) || array_search(substr($subscriber['user_phone'], 0, 7), $airtel2)) { $check_bal_url = 'http://172.24.87.125:31110/mmarket/get_bal?msisdn=' . checkDestination($subscriber['user_phone']); $owo = do_response($check_bal_url); $bal = (int) trim($owo); $bal_ngn = $bal / 100; echo checkDestination($subscriber['user_phone']).':'.$owo.'<br>'; if ($bal_ngn < 50) { $msg = 'Dear Subscriber, you have insufficent balance to renew your mHealth service. To subscribe to mHealth services dial *776#, costs #50. Thank you.'; smsSender4(checkDestination($subscriber['user_phone']), $msg);
echo $subscribers['user_phone']; echo '<br/>'; echo $tip['gist']; echo '<br/>'; echo '35123'; echo '<br/>'; } elseif (array_search(substr($subscribers['user_phone'], 0, 6), $etisalat) || array_search(substr($subscribers['user_phone'], 0, 7), $etisalat2)) { smsSender3(checkDestination($subscribers['user_phone']), $tip['gist']); echo $subscribers['user_phone']; echo '<br/>'; echo $tip['gist']; echo '<br/>'; echo '32126'; echo '<br/>'; } elseif (array_search(substr($subscribers['user_phone'], 0, 6), $airtel) || array_search(substr($subscribers['user_phone'], 0, 7), $airtel2)) { smsSender4(checkDestination($subscribers['user_phone']), $tip['gist']); echo $subscribers['user_phone']; echo '<br/>'; echo $tip['gist']; echo '<br/>'; echo '33121'; echo '<br/>'; } else { smsSender2(checkDestination($subscribers['user_phone']), $tip['gist']); echo $subscribers['user_phone']; echo '<br/>'; echo $tip['gist']; echo '<br/>'; echo '35121'; echo '<br/>'; }