File manager - Edit - /home/autoph/public_html/data03252025consolidation/app/cron/cron_insurance_send.php
Back
<?php include_once("../../cfg/db.php"); include_once("../sms/sms_start.php"); include_once("../../api/controllers/utility.php"); ini_set('max_execution_time', '0'); set_time_limit(0); ini_set('memory_limit','-1'); //1377110940314850 $utility = new Utility(); if(isset($argv[1])){ parse_str($argv[1], $params); if(isset($params['apiKey']) && $params['apiKey'] === '1377110940314850'){ $count = $db->select("SELECT COUNT(*) FROM `txtblast_insurance_reminder_record` WHERE `sms_response` = -1"); if($count > 0){ //if table is not empty $request_id = ""; $cust_id = ""; $mobile_number = ""; while($count > 0){ $rows = $db->sql_query("SELECT tbirr.finance_id, f.customer_mobile_number, tbirr.reminder_type, tbirr.message FROM `txtblast_insurance_reminder_record` tbirr INNER JOIN `finance` f ON f.id = tbirr.finance_id WHERE tbirr.sms_response = -1 LIMIT 1"); $finance_id = ""; $mobile_number = ""; $reminder_type = ""; $message = ""; foreach($rows AS $row){ $finance_id = $row['finance_id']; $mobile_number = checkForValidNumber($row['customer_mobile_number'], $utility); $reminder_type = $row['reminder_type']; $message = $row['message']; } $cleaned_message = str_replace("\r\n", "\n", $message); $isValid = substr($mobile_number, 0, 4); if($isValid == "+639" && strlen($mobile_number) == 13){ //valid number $send_sms = new SMS(); //call send message function $sms_response = $send_sms->sendSMS($mobile_number, $cleaned_message, $variable); // SEND TEXT // $status = -2; //not activated (test live sent status) //set status if($sms_response == 0){ // success $current_datetime = $db->select("SELECT NOW() AS now"); $db->sql_query("UPDATE `txtblast_insurance_reminder_record` SET `sms_response` = '$sms_response', `message` = '', `action_date` = '$current_datetime' WHERE `finance_id` = '$finance_id' AND `reminder_type` = '$reminder_type'"); } else { $current_datetime = $db->select("SELECT NOW() AS now"); $db->sql_query("UPDATE `txtblast_insurance_reminder_record` SET `sms_response` = '$sms_response',`action_date` = '$current_datetime' WHERE `finance_id` = '$finance_id' AND `reminder_type` = '$reminder_type'"); } } else { // invalid number // $cleaned_message = $db->escape($cleaned_message); // $cleaned_message = str_replace("\n", "\r\n", $cleaned_message); $current_datetime = $db->select("SELECT NOW() AS now"); $db->sql_query("UPDATE `txtblast_insurance_reminder_record` SET `sms_response` = 1, `message` = '', `action_date` = '$current_datetime' WHERE `finance_id` = '$finance_id' AND `reminder_type` = '$reminder_type'"); } sleep(2); // less count by 1 $count--; } } return; //always execute this } } echo "What are you doing? "; //this will appear if there's an error on param or code function checkForValidNumber($data, $utility){ $data_to_return = ""; if(strpos($data, '/') > 0){ $multi_mobile = array(); $multi_mobile = explode("/", $data); $multi_mobile[0] = $utility->fix_mobile_format(remove_non_numeric($multi_mobile[0])); $multi_mobile[1] = $utility->fix_mobile_format(remove_non_numeric($multi_mobile[1])); $isValid1 = isMobileValid($multi_mobile[0]); if($isValid1 == 1){ // mobile 1 is valid $data_to_return = $multi_mobile[0]; } else { // mobile 2 instead $isValid2 = isMobileValid($multi_mobile[1]); if($isValid2 == 1){ // mobile 1 is valid $data_to_return = $multi_mobile[1]; } else { // if mobile 2 is still not valid, return mobile 1, may lead to invalid mobile number $data_to_return = $multi_mobile[0]; } } } else { $data_to_return = $data; } return $data_to_return; } function isMobileValid($data){ if(substr($data, 0, 4 ) === "+639"){ if(strlen($data) == 13){ return 1; } else { return 0; } } else { return 0; } } function remove_non_numeric($data){ return preg_replace("/[^0-9\/s\/]/", "", $data); // return preg_replace("/[^0-9]/","",$data); } ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings