示例#1
0
 public function __destruct()
 {
     $this->values['end'] = date('H:i:s');
     $logdb = new log_database();
     try {
         $logdb->logSMSStatus($this->values);
         //throw new dbException('PACKET OVERFLOW',1153);
     } catch (dbException $e) {
         if ($e->getCode() == 1153) {
             //max_allowed_packet
             $logf = new log_file('/packet_overflow/');
             if ($logf->packet_overflow($this->values)) {
                 $this->values['log_message'] = "LOG TEXT OVER MySQL max_packet_size, WRITTEN TO " . $logf->path;
                 $logdb->logSMSStatus($this->values);
             } else {
                 $this->values['log_message'] = "TRIED TO CREATE LOG FILE AND FAILED " . $logf->path;
             }
             $this->status(CRITICAL);
             $logdb->logSMSStatus($this->values);
         } else {
             debug::output($e->getMessage());
             $this->status(WARNING);
         }
     }
 }
示例#2
0
chdir('../');
include_once 'init.inc.php';
config::set('process_name', "Text Anywhere - Send Premium SMS");
include_once 'start.inc.php';
if ($_GET['argv1']) {
    $arg = $_GET['argv1'];
} else {
    $arg = $argv[1];
}
switch ($arg) {
    case "test":
        $live = false;
        break;
    case "live":
        $live = true;
        break;
    default:
        $live = false;
}
try {
    $log = new log_database();
    $send['rbid'] = '879762236';
    $send['body'] = 'This is a test message';
    $send['clientMessageReference'] = $log->logOutboundSMS($send);
    utils::recursiveCall('sendPremiumSMS', $send, 1, $live);
} catch (Exception $e) {
    debug::output($e->getMessage());
    //$status->status(CRITICAL);
}
include 'end.inc.php';
示例#3
0
 public function old()
 {
     $originator = $cleanData['originator'];
     $destination = $cleanData['destination'];
     $clientmessagereference = $cleanData['clientmessagereference'];
     $date = $cleanData['date'];
     $time = $cleanData['time'];
     $body = $cleanData['body'];
     $rbid = $cleanData['rbid'];
     $log = new log_database();
     $log->logTagActivation($cleanData);
     $send['returnCSVString'] = false;
     $send['clientBillingReference'] = '0';
     $send['clientMessageReference'] = '1';
     // create new reference using primary key from database
     $send['originator'] = ORIGINATOR;
     $send['destinations'] = '';
     $send['validity'] = '1';
     $send['characterSetID'] = 2;
     $send['replyMethodID'] = 2;
     $send['replyData'] = config::get('ta_replyemail');
     $send['StatusNotificationUrl'] = '';
     if (stristr($body, ORIGINATOR)) {
         $body = trim(str_ireplace(ORIGINATOR, '', $body));
         $tags = explode(',', $body);
         //check PIN ID valid against expected format
         $validity = parent::checkTagValidityBasic($tags);
         if ($validity == false) {
             $send['body'] = 'One or more tags are not being recognised by our system please check and try again.';
             utils::recursiveCall('sendSMS', $send, 1, $live);
             $valid = false;
         } else {
             //check PIN ID valid against database
             $tagData = parent::checkTagValidityDatabase($tags);
             if ($tagData == false) {
                 $send['body'] = 'There seems to be a problem please call XXXXXXX';
                 utils::recursiveCall('sendSMS', $send, 1, $live);
                 $valid = false;
             } else {
                 $cost = $tagData['cost'];
                 $send['body'] = 'Tags are valid and ready to be activated, text YES to proceed or STOP to cancel, text cost £' . $cost . ' for 3 month membership for paper tags. Plastic tags attract a years membership for FREE';
                 utils::recursiveCall('sendSMS', $send, 1, $live);
                 $valid = true;
             }
             //else pins valid
         }
         //pins ok
     } elseif (stristr($body, 'YES')) {
         //creat user account using existing function
         $username = '';
         $password = '';
         $send['body'] = 'Your account has been successfully created, please log in using username ' . $username . ' and password ' . $password . ' to enter your email address.';
         utils::recursiveCall('sendSMS', $send, 1, $live);
         $valid = true;
     } elseif (stristr($body, 'STOP')) {
         //opt out
         //add recipient to suppression list. Use this list to ensure recipient is not contacted accidentily
         echo "add recipient to suppression list. Use this list to ensure recipient is not contacted accidentily";
         $valid = true;
     } else {
         //not a valid response. log details
         echo "not a valid response. log details";
         $valid = false;
     }
     debug::output($send['body']);
 }