function sendsms() { $type = $_POST['type']; $amt = $_POST['amt']; $msg = $_POST['msg']; $when = $_POST['when']; // get numbers if ($type == "thai") { $query = $this->db->query('SELECT `id`,`name`,`number` FROM `contact_numbers` WHERE `status` = "1" AND `sent` != "1" LIMIT ' . $amt . ''); } $contacts = $query->result(); include "/home/www/xxxxxx.com/htdocs/js/sms/sms.class.php"; $result_message = 'SMS RESULTS<br />'; //print_r($contacts); foreach ($contacts as $c) { $username = '******'; $password = '******'; //$username = '******'; //$password = '******'; $ph = str_replace('+66', '0', $c->number); $msisdn = $ph; $message = str_replace('**NAME**', $c->name == "" ? '' : $c->name, $msg); $message = str_replace('**Name**', $c->name == "" ? '' : $c->name, $message); $message = str_replace('**name**', $c->name == "" ? '' : $c->name, $message); $sender = 'xxxxxx'; //$sender = 'THAIBULKSMS'; $ScheduledDelivery = $when; $force = 'standard'; $result = sms::send_sms($username, $password, $msisdn, $message, $sender, $ScheduledDelivery, $force); $result_message .= 'Id: ' . $c->id . ' name: ' . $c->name . ' number: ' . $ph . ' result:' . $result . '<br /><br />'; // update number $query = $this->db->query('UPDATE `contact_numbers` SET `sent` = 1 WHERE `id` = "' . $c->id . '"'); } echo $result_message; exit; }
<html> <head> <meta charset="utf-8" /> </head> <body> <?php include "sms.class.php"; //$username = $_REQUEST['username']; //$password = $_REQUEST['password']; $username = '******'; $password = '******'; $msisdn = $_REQUEST['msisdn']; $message = $_REQUEST['message']; $sender = $_REQUEST['sender']; $ScheduledDelivery = $_REQUEST['ScheduledDelivery']; $force = $_REQUEST['force']; $result = sms::send_sms($username, $password, $msisdn, $message, $sender, $ScheduledDelivery, $force); echo $result; ?> </body> </html>
function do_bat_sms() { $this->model_issn->user_auth(); $s_num = $this->input->xss_clean($this->input->post('s_num')); $content = ico($this->input->xss_clean($this->input->post('content'))); if ($s_num === 'all') { $q = $this->db->get(PHONE_TABLE); } else { if (!empty($s_num)) { $q = $this->db->get(PHONE_TABLE, $s_num, 0); } else { exit; } } $this->config->load('sms'); if ($q->num_rows() > 0) { foreach ($q->result_array() as $row) { $sms_to = $row['phone_no']; $re = sms::send_sms($sms_to, $content, $this->config->item('uid'), $this->config->item('pwd')); if ($re !== true) { //更新邮件成功率! } } } else { die('手机号库中,没有任何信息'); } echo '发送完毕'; }