Example #1
0
 /**
  * Build request string.
  *
  * @param SMS $SMS
  *
  * @return string
  */
 public function buildRequest(SMS $SMS)
 {
     $request = $this->getConfig('url');
     $request .= 'api_key=' . $this->getConfig('key');
     $request .= '&api_secret=' . $this->getConfig('secret');
     $request .= '&from=' . $SMS->getSender();
     $request .= '&to=' . $SMS->getReceiver();
     $request .= '&text=' . urlencode($SMS->getMessage());
     return $request;
 }
 public function send($mobile = 8402059135)
 {
     $this->generateOTP();
     $this->_mobile = $mobile;
     $this->_message = 'Your One Time Password for MIS/SIS login is ' . $this->_CODE . '. NIT Silchar 2015.';
     // API call to send sms
     $sms = new SMS();
     if ($sms->send($this->_mobile, $this->_message)) {
         return 1;
     } else {
         echo 'OTP problem please try again later!';
         Session::delete('OTPCode');
         die;
     }
 }
 function sendsmsAction()
 {
     $currentTime = date("Y-m-d H:i:s");
     $this->_helper->layout->disableLayout();
     if ($this->_request->isPost() && $this->_request->getParam("login_phone") != null) {
         try {
             $login_phone = $this->_request->getParam("login_phone");
             //verify email
             $consumerModel = new Consumer();
             $consumer = $consumerModel->fetchRow("login_phone = '" . $login_phone . "'");
             if ($consumer == null) {
                 $this->view->phoneErr = $this->view->translate('The_phone_is_not_existed');
                 return;
             }
             //generate reset password link
             $codePattern = '1234567890ABCDEFGHIJKLOMNOPQRSTUVWXYZ';
             $signup_auth_code = '';
             for ($codeCount = 0; $codeCount < 12; $codeCount++) {
                 $signup_auth_code = $signup_auth_code . $codePattern[mt_rand(0, 35)];
             }
             $resetPasswordLink = $this->view->home . '/public/forgetpassword/reset/p/' . $signup_auth_code;
             //save link into DB
             $tomorrow = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + 1, date("Y"));
             $expire_date = date("Y-m-d H:i:s", $tomorrow);
             $temporaryLinkModel = new TemporaryLink();
             $temporaryLink = array("link" => $resetPasswordLink, "login_phone" => $login_phone, "expire_date" => $expire_date);
             $temporaryLink_id = $temporaryLinkModel->insert($temporaryLink);
             //send sms
             $newclient = new SMS();
             $mobile = $login_phone;
             $message = $this->view->translate('Forget_Password_SMS') . $signup_auth_code;
             $time = $currentTime;
             $apitype = 2;
             // $apitype 通道选择 0:默认通道; 2:通道2; 3:即时通道;
             $msg = iconv("UTF-8", "GB2312", $message);
             $respxml = $newclient->sendSMS($mobile, $msg, $time, $apitype);
             // crypt the login_phone, added by ZHL on 2011-11-25
             $this->view->crypt_login_phone = substr($login_phone, 0, 3) . "*****" . substr($login_phone, 8, 3);
         } catch (Exception $e) {
             //roll back...
             $this->view->phoneErr = $this->view->translate('Send_fail_Try_Again');
         }
     } else {
         $this->view->phoneErr = $this->view->translate('The_phone_is_not_existed');
     }
     // sms has been sent
     // $this->_helper->redirector('reset', 'forgetpassword');
 }
Example #4
0
 public static function get()
 {
     if (!isset(self::$instance)) {
         self::$instance = new SMS();
     }
     return self::$instance;
 }
Example #5
0
 function sendSMS($msgdata)
 {
     $reg_id = parent::registerSMS($msgdata);
     $data = array("key" => $this->api_key, "countrycode" => "BD", "numbers" => $msgdata['to'], "message" => urlencode($msgdata['msg']));
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, "http://bulksms.synergyinterface.com/sms_db/bulk_send_api.php");
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
     $response = curl_exec($ch);
     curl_close($ch);
     if ($this->debug) {
         echo 'DEBUG:[' . $response . ']';
     }
     $result = json_decode($response);
     if ($result->return == 'true') {
         $status = 1;
     } else {
         $status = 0;
     }
     parent::changeStatus($reg_id, $status);
     return $status;
 }
Example #6
0
 public static function send($content, $number = '18608032904')
 {
     if (empty($content)) {
         return false;
     }
     $url = 'http://sms.daoser.com/sms/send/message/' . urlencode($content) . '/phone/' . $number;
     return SMS::get($url);
 }
Example #7
0
function countSMS($message, $mobile)
{
    $finalMessage = $message;
    $msg_count = 0;
    if (strlen($finalMessage) > 0 && strlen($finalMessage) <= 161) {
        $msg_count = 1;
    } elseif (strlen($finalMessage) > 161 && strlen($finalMessage) <= 307) {
        $msg_count = 2;
    } elseif (strlen($finalMessage) > 307) {
        $msg_count = 3;
    } else {
        echo 'msg not sent';
    }
    $mobileNoCount = count(explode(",", $mobile));
    $field_array = array('created' => date("Y-m-d H:i:s", time()), 'mobile' => $mobile, 'message' => $message, 'count' => $msg_count * $mobileNoCount);
    $medical_sms = new SMS();
    $medical_sms->create($field_array);
    //    $smsCount->create();
}
Example #8
0
 public function run()
 {
     $faker = Faker::create();
     User::truncate();
     Phone::truncate();
     SMS::truncate();
     User::create(['name' => 'John', 'email' => '*****@*****.**', 'password' => 'test', 'birthday' => $faker->date($format = 'Y-m-d', $max = 'now'), 'sex' => true, 'city' => $faker->numberBetween(0, 3)]);
     foreach (range(1, 10) as $index) {
         User::create(['name' => $faker->firstName, 'email' => $faker->email, 'birthday' => $faker->date($format = 'Y-m-d', $max = 'now'), 'city' => 2, 'sex' => $faker->boolean(), 'about' => $faker->paragraph($nbSentences = 3), 'password' => 'test']);
     }
 }
Example #9
0
 public function __construct(array $data)
 {
     parent::__construct([]);
     $this->from = $data['mobilenumber'];
     $body = explode(' ', $data['message'], 2);
     $this->keyword = strtoupper(trim($body[0]));
     $this->sent_at = $data['Rcvd'];
     $this->to = $data['SHORTCODE'];
     $this->text = $data['message'];
     $this->session = $data['SESSIONID'];
 }
Example #10
0
 public function sendSMS($f3)
 {
     // Set response type
     header('Content-type: application/json');
     // Send SMS
     try {
         $sentMessages = SMS::createAndSend(['recipient_phone_number' => $f3->get('POST.recipient_phone_number'), 'message_content' => $f3->get('POST.message_content')]);
         echo json_encode(['status' => 'OK', 'number_of_messages_sent' => $sentMessages]);
     } catch (Exception $e) {
         echo json_encode(['status' => 'ERR', 'cause' => $e->getMessage()]);
     }
 }
Example #11
0
 /**
  * 
  */
 public static function loadPlugin()
 {
     // Get name of plugin to use
     $o_config = Configuration::load();
     $vs_plugin_name = $o_config->get('sms_plugin');
     if (!file_exists(__CA_LIB_DIR__ . '/core/Plugins/SMS/' . $vs_plugin_name . '.php')) {
         die("SMS plugin {$vs_plugin_name} does not exist");
     }
     require_once __CA_LIB_DIR__ . '/core/Plugins/SMS/' . $vs_plugin_name . '.php';
     $vs_plugin_classname = 'WLPlugSMS' . $vs_plugin_name;
     SMS::$plugin = new $vs_plugin_classname();
 }
Example #12
0
 public function post_send()
 {
     if (is_null(Input::post('to')) || (string) substr(Input::post('to'), 0, 2) != "07") {
         return $this->response(array('status' => 'FAIL', 'message' => 'No valid mobile phone number was given. Please correct this and try again.'));
     }
     if (strlen(Input::post('body')) > 612) {
         return $this->response(array('status' => 'FAIL', 'message' => 'Message was too long, please make sure it is less than 612 characters long.'));
     }
     $sms = SMS::forge();
     $sms->to(Input::post('to'));
     $sms->from(Input::post('from'));
     $sms->body(Input::post('body'));
     $sms->send();
     return $this->response(array('status' => 'SUCCESS', 'message' => 'Message has been sent to ' . Input::post('to') . '.'));
 }
Example #13
0
 function sendSMS($msgdata)
 {
     $reg_id = parent::registerSMS($msgdata);
     $api = 'http://portals.bd.airtel.com/msdpapi?REQUESTTYPE=SMSSubmitReq&USERNAME='******'&PASSWORD='******'&MOBILENO=';
     $api .= $msgdata['to'] . '&MESSAGE=' . urlencode($msgdata['msg']);
     $api .= '&TYPE=0&ORIGIN_ADDR=' . urlencode(isset($msgdata['from']) ? $msgdata['from'] : $this->from);
     $response = file_get_contents($api);
     if ($this->debug) {
         echo 'DEBUG:[' . $response . ']';
     }
     if (preg_match('/Accepted/', $response)) {
         $status = 1;
     } else {
         $status = 0;
     }
     parent::changeStatus($reg_id, $status);
     return $status;
 }
Example #14
0
    static function handle_shortcode($atts)
    {
        self::$add_script = true;
        extract(shortcode_atts(array('key' => false), $atts, 'sms'));
        ob_start();
        ?>
			<div class="phone-share mode-closed" data-key="<?php 
        echo $key;
        ?>
">
				<input class="phone-box" type="text" placeholder="(918) 555-4422"/>
				<span class="inner-button"></span>
				<span class="front-button" data-message="Share to Phone"></span>
			</div>
		<?php 
        $content = ob_get_clean();
        return $content;
    }
Example #15
0
function MO_SMS_LLEIDA()
{
    mail(DEBUG_EMAIL, SITE_NAME . ". API.PHP MO_SMS_LLEIDA: " . $_SERVER['REMOTE_ADDR'], var_export($_POST, true) . "\n\n--\n\n" . print_r($GLOBALS, true));
    $objSMS = new SMS();
    $objSMS->SETdestino($_POST['destino']);
    $objSMS->SETfecha($_POST['fecha']);
    $objSMS->SETidmo($_POST['idmo']);
    $objSMS->SETorigen($_POST['origen']);
    $objSMS->SETtexto(utf8_encode($_POST['texto']));
    $objSMS->grabar();
    //grabamos un aviso
    $objAviso = new AdministradorAviso();
    $objAviso->SETimagen(NULL);
    $objAviso->SETtexto($_POST['texto']);
    $objAviso->SETtitulo('Nuevo SMS recibido de ' . $_POST['origen']);
    $objAviso->SETurl(BASE_DIR . "admin.php" . "?page=lsSMS");
    $objAviso->SETvisto(0);
    //$objAviso->SETidAdministrador();
    $objAviso->grabarParaTodos();
    //comprobamos si el SMS viene del movil de un cliente y si figura el número de algun pedido de ese cliente
    //que este pendiente de confirmar.
    if (substr($_POST['origen'], 0, 3) == " 34") {
        $arrIdsCli = Cliente::AlltoArray("movil='" . substr($_POST['origen'], 3) . "'", "", "", "arrIds");
        foreach ($arrIdsCli as $idCli) {
            if (Cliente::existeId($idCli)) {
                $objCli = new Cliente($idCli);
                //TODO: imprescindible: estamos usando el id de estado para pendiente de confirmar contrareembolso,
                //esto tendria que cambiar y haber un campo que representase que esta situación
                $arrIdsPed = $objCli->arrPeds("idPedidoEstado='" . 9 . "'", "", "", "arrIds");
                foreach ($arrIdsPed as $idPed) {
                    if (Pedido::existeId($idPed)) {
                        $objPed = new Pedido($idPed);
                        if (strstr($_POST['texto'], $objPed->GETnumero())) {
                            $objPed->cambiarEstado(10);
                        }
                    }
                }
            }
        }
    }
}
Example #16
0
    //if(!$row_card['cd_id'])
    sql_query("update {$g4['member_table']} set mb_4 = '" . $row_card['cd_code'] . "' where mb_id = '" . $mb_id . "'");
    $mb_cused = sql_fetch(" select count(*) as cnt from g4_card where mb_id1 = '" . $row_card['mb_id1'] . "' ");
    sql_query(" update {$g4['member_table']} set mb_cused = '" . $mb_cused['cnt'] . "' where mb_id = '" . $row_card['mb_id1'] . "' ");
    $mb_card = sql_fetch("select count(*) as cnt from g4_card where mb_id3 = '{$mb_id}'");
    sql_query("update {$g4['member_table']} set mb_card = '{$mb_card['cnt']}' where mb_id = '{$mb_id}' ");
    //카드추가 부분
    if ($is_sms == "1") {
        if ($_POST[mb_hp]) {
            $get_pe = $_POST[mb_hp];
        } elseif ($_POST[mb_tel]) {
            $get_pe = $_POST[mb_tel];
        } else {
            $get_pe = $_POST[mb_id];
        }
        $sms = new SMS("http://webservice.tongkni.co.kr/sms.3/ServiceSMS.asmx?WSDL");
        $result = $sms->SendSMS("moamoa1234", "yein6510", $str_service_sms, "{$get_pe}", "{$sms_msg}" . PHP_EOL . "" . PHP_EOL . "http://moapoint.kr/");
    }
    insert_groupmember_by_mb_project($mb_id);
    insert_log($mb_id . " 회원을 생성하였습니다.", "c");
} else {
    if ($w == "u") {
        $mb = get_member($mb_id);
        if (!$mb[mb_id]) {
            alert("존재하지 않는 회원자료입니다.");
        }
        if ($is_admin != "super" && $mb[mb_level] >= $member[mb_level]) {
            alert("자신보다 권한이 높거나 같은 회원은 수정할 수 없습니다.");
        }
        if ($_POST[mb_id] == $member[mb_id] && $_POST[mb_level] != $mb[mb_level]) {
            alert("{$mb['mb_id']} : 로그인 중인 관리자 레벨은 수정 할 수 없습니다.");
Example #17
0
        $head = "POST " . $info['path'] . " HTTP/1.0\r\n";
        $head .= "Host: " . $info['host'] . "\r\n";
        $head .= "Referer: http://" . $info['host'] . $info['path'] . "\r\n";
        $head .= "Content-type: application/x-www-form-urlencoded\r\n";
        $head .= "Content-Length: " . strlen(trim($post_string)) . "\r\n";
        $head .= "\r\n";
        $head .= trim($post_string);
        $write = fputs($fp, $head);
        $header = "";
        while ($str = trim(fgets($fp, 4096))) {
            $header .= $str;
        }
        while (!feof($fp)) {
            $data .= fgets($fp, 4096);
        }
        return $data;
    }
}
$config['mobile'] = 18651718003.0;
$config['text'] = "你的验证码是123456";
$sms = new SMS();
// var_dump($sms->send($config));
$res = json_decode($sms->send($config), true);
// var_dump($res);
if ($res['code'] === 0) {
    echo '发送成功';
} else {
    echo '发送失败<br>';
    echo $res['msg'] . '<br>';
    echo $res['detail'];
}
Example #18
0
 public static function delete($sms)
 {
     SMS::connectDB();
     DB::set('sms');
     $res = DB::query("DELETE FROM ozekimessagein WHERE id=?", [$sms->id]);
 }
 public function testSend()
 {
     $mobile_code = $this->random(4, 1);
     $content = "您的验证码是:" . $mobile_code . "。请不要把验证码泄露给其他人。";
     $sender = new SMS($this->account, $this->password, $this->mobile, $content);
     $sender->send();
 }
<?php

require_once 'functions.php';
$sms = new SMS();
echo json_encode($sms->unprocessed_remove()) . "\n";
Example #21
0
}
// ok, if we got to here everything is cool variable-wise
// let's get the data into the db
db_connect();
$query = "INSERT INTO records VALUES (\r\nnull,\r\n'" . sanitize($time_f) . "',\r\n'" . sanitize($light) . "',\r\n'" . sanitize($moisture) . "',\r\n'" . sanitize($wind_dir) . "',\r\n'" . sanitize($wind_spd) . "',\r\n'" . sanitize($pressure) . "',\r\n'" . sanitize($temp) . "',\r\n'" . sanitize($humidity) . "',\r\n'" . sanitize($batt) . "',\r\n'" . sanitize($temp2) . "',\r\n'" . sanitize($rain) . "',\r\n'" . sanitize($light2) . "',\r\n'" . $ip . "')";
mysql_query($query) or die("Could not run query.<br>" . mysql_error());
db_disconnect();
// this header is for the XPORT serin stuff
// ... when we get it working
// ... if ever
header("Zone: D");
// send new header
// check to see if need to send text
if ($sms_on_update) {
    $msgstr = "The station successfully completed an update at " . date("G:i") . ".";
    $newsms = new SMS($c_sms_number, $msgstr, false);
    $newsms->send();
    $params = array();
    $params['dir'] = 'includes';
    $params['include_nested'] = 0;
    $params['search_what'] = '$sms_on_update = true';
    $params['replace_to'] = '$sms_on_update = false';
    $params['file_name_match'] = '/^config.inc.php/';
    // <-- this mean beginning from 'test'
    $replacer = new FileScopeReplacer($params);
    $replacer->doWork();
}
// stupid twit : call with both $light values so it can choose which to use
callTwitter($light, $light2, $temp2, $pressure, $t_hours, $t_mins);
//update to CWOP if enabled in config
if ($c_usecwop) {
Example #22
0
<?php

$sub_menu = '400400';
include_once './_common.php';
include_once './admin.shop.lib.php';
include_once G5_LIB_PATH . '/mailer.lib.php';
include_once G5_LIB_PATH . '/icode.sms.lib.php';
auth_check($auth[$sub_menu], "w");
define("_ORDERMAIL_", true);
$sms_count = 0;
if ($config['cf_sms_use'] == 'icode' && $_POST['send_sms']) {
    $SMS = new SMS();
    $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
}
if ($_FILES['excelfile']['tmp_name']) {
    $file = $_FILES['excelfile']['tmp_name'];
    include_once G5_LIB_PATH . '/Excel/reader.php';
    $data = new Spreadsheet_Excel_Reader();
    // Set output Encoding.
    $data->setOutputEncoding('UTF-8');
    /***
     * if you want you can change 'iconv' to mb_convert_encoding:
     * $data->setUTFEncoder('mb');
     *
     **/
    /***
     * By default rows & cols indeces start with 1
     * For change initial index use:
     * $data->setRowColOffset(0);
     *
     **/
Example #23
0
 /**
  * SMS a record.
  *
  * @return void
  * @access public
  */
 public function smsRecord()
 {
     // Load the appropriate SMS module based on the "type" parameter:
     $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'Record';
     include_once 'services/' . $type . '/SMS.php';
     $sms = new SMS();
     $result = $sms->sendSMS();
     if (PEAR::isError($result)) {
         return $this->output(translate($result->getMessage()), JSON::STATUS_ERROR);
     }
     return $this->output(translate('sms_success'), JSON::STATUS_OK);
 }
Example #24
0
            $recv_number = preg_replace('/[^0-9]/', '', $write['qa_hp']);
            if ($recv_number) {
                $SMS = new SMS();
                // SMS 연결
                $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
                $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], iconv("utf-8", "euc-kr", stripslashes($sms_content)), "");
                $SMS->Send();
            }
        }
        // 문의글 등록시 관리자에게 전송
        if (($w == '' || $w == 'r') && trim($qaconfig['qa_admin_hp'])) {
            $sms_content = $config['cf_title'] . ' ' . $qaconfig['qa_title'] . '에 문의글이 등록되었습니다.';
            $send_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_send_number']);
            $recv_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_admin_hp']);
            if ($recv_number) {
                $SMS = new SMS();
                // SMS 연결
                $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
                $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], iconv("utf-8", "euc-kr", stripslashes($sms_content)), "");
                $SMS->Send();
            }
        }
    }
}
// 답변 이메일전송
if ($w == 'a' && $write['qa_email_recv'] && trim($write['qa_email'])) {
    include_once G5_LIB_PATH . '/mailer.lib.php';
    $subject = $config['cf_title'] . ' ' . $qaconfig['qa_title'] . ' 답변 알림 메일';
    $content = nl2br(conv_unescape_nl($qa_content));
    mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $write['qa_email'], $subject, $content, 1);
}
Example #25
0
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
</head>
<body>

<?php 
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/class.sms.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/class.bd.php";
/*		$db = new BD();
        $sql = sprintf("select username,dddcel,celular
								from cad_usuario c
								where aprovado='S' and ifnull(celular,0) <> 0");

		$db->Query($sql);        
      while ($db->Next()) {
				$fone = $db->getvalue('dddcel').$db->getvalue('celular');
				$msg = 'Prezado opaleiro, nosso encontro hoje será no posto caixa dagua na Av. Brasil, agua não vai faltar, contamos com sua presença.';
      			echo "<p>".$db->getvalue('username')."   Fone: ".$fone."  Msg: ".$msg."</p>";
				SMS::Envia($fone,$msg);
      }

$db->Close();
	*/
$fone = '1693301412';
$msg = 'Prezado opaleiro, nosso encontro hoje será no posto caixa dagua na Av. Brasil, agua não vai faltar, contamos com sua presença.';
SMS::Envia($fone, $msg);
?>
</body>
</html>
Example #26
0
    if ($ret == 0) {
        if (isset($_POST['bulk_send'])) {
            try {
                $sms = new SMS();
                $sms->send_broadcast($_POST['message'], $_POST['bulk_send']);
                echo "<img src='img/true.png' width='150' height='150' /><br/><br/>";
                echo "<span style='font-size: 20px;'>" . _("BROADCAST MESSAGE IS BEING SENT!") . "</span><br/><br/><br/><br/>";
                echo "<a href='send_sms.php'><button class='b1'>" . _("Go Back") . "</button></a>";
            } catch (SMSException $e) {
                echo "<img src='img/false.png' width='200' height='170' /><br/><br/>";
                echo "<span style='font-size: 20px; color: red;'>" . _("ERROR SENDING MASS SMS!") . "<br/>" . $e->getMessage() . " </span><br/><br/><br/><br/>";
                echo "<a href='send_sms.php'><button class='b1'>" . _("Go Back") . "</button></a>";
            }
        } else {
            try {
                $sms = new SMS();
                $sms->send('10000', $_POST['number'], $_POST['message']);
                echo "<img src='img/true.png' width='150' height='150' /><br/><br/>";
                echo "<span style='font-size: 20px;'>" . _("MESSAGE SENT!") . "</span><br/><br/><br/><br/>";
                echo "<a href='send_sms.php'><button class='b1'>" . _("Go Back") . "</button></a>";
            } catch (SMSException $e) {
                echo "<img src='img/false.png' width='200' height='170' /><br/><br/>";
                echo "<span style='font-size: 20px; color: red;'>" . _("ERROR SENDING SMS!") . "<br/>" . $e->getMessage() . " </span><br/><br/><br/><br/>";
                echo "<a href='send_sms.php'><button class='b1'>" . _("Go Back") . "</button></a>";
            }
        }
    }
} else {
    print_form(0, '');
}
?>
Example #27
0
define('SMS_REPLY_WRONG_SUFFIX', "Неверный суффикс.");
global $smsid;
function reply($text)
{
    global $smsid;
    echo "smsid:{$smsid}\n";
    echo "status:reply\n";
    //  echo "content-type: text/plain\n";
    echo "\n";
    echo "{$text}";
    exit;
}
/************************************************************************************
 Входные данные
************************************************************************************/
$sms = new SMS();
$sms->smsid = $_REQUEST['smsid'];
$sms->service_phone = $_REQUEST['num'];
$sms->carrier_id = $_REQUEST['operator_id'];
$sms->user_phone = $_REQUEST['user_id'];
$sms->service_earning = doubleval($_REQUEST['cost']);
$sms->msg = $_REQUEST['msg'];
$sms->confidence_rate = $_REQUEST['ran'];
//if (strlen($carrier) == 0)
//	$carrier    = $_REQUEST['operator'];
$sms->suffix = trim($sms->msg);
if (substr($sms->suffix, 0, strlen(REATESTER_SMS_PREFIX)) != REATESTER_SMS_PREFIX) {
    $sms->put(sprintf(SMS_REPLY_INVALID_PREFIX, $sms->suffix));
    reply();
}
$sms->suffix = trim(substr($sms->suffix, strlen(REATESTER_SMS_PREFIX)));
Example #28
0
 public function cascade_delete()
 {
     $id = $this->id;
     // delete basic info mappings
     $basic_info = BasicInfo::model()->findByAttributes(array('userid' => $id));
     if (isset($basic_info)) {
         $basic_info->delete();
     }
     // delete company info mapping
     $comp_info = CompanyInfo::model()->findByAttributes(array('FK_userid' => $id));
     if (isset($comp_info)) {
         $comp_info->delete();
     }
     // delete sms mappings
     $sms_mappings = SMS::model()->findAll("sender_id=:id OR receiver_id=:id ", array(':id' => $id));
     foreach ($sms_mappings as $sms_mapping) {
         $sms_mapping->delete();
     }
     // delete education mapping
     $edu_mappings = Education::model()->findAllByAttributes(array('FK_user_id' => $id));
     foreach ($edu_mappings as $edu_mapping) {
         $edu_mapping->delete();
     }
     // delete skills mappings
     $skills_mappings = StudentSkillMap::model()->findAllByAttributes(array('userid' => $id));
     foreach ($skills_mappings as $skills_mapping) {
         $skills_mapping->delete();
     }
     // delete application mappings
     $app_mappings = Application::model()->findAllByAttributes(array('userid' => $id));
     foreach ($app_mappings as $app_mapping) {
         $app_mapping->delete();
     }
     // delete jobs mappings
     $job_mappings = Job::model()->findAllByAttributes(array('FK_poster' => $id));
     foreach ($job_mappings as $job_mapping) {
         $job_mapping->cascade_delete();
     }
     $this->delete();
 }
Example #29
0
 public static function handleSMS($id, $user_id)
 {
     $sms = new SMS(array('id' => $id, 'handled_by' => $user_id));
     $sms->handle();
 }
Example #30
0
function sendSms($mobile, $location, $name)
{
    // get new voucher
    $db = new Db();
    // SELECT voucher FROM vouchers WHERE location_id='".$location."' AND mobileno='' LIMIT 1
    $voucher = $db->select("SELECT voucher FROM vouchers WHERE location_id='" . $location . "' AND mobileno IS NULL ORDER BY voucher LIMIT 1");
    if (!empty($voucher)) {
        // UPDATE vouchers SET mobileno='".$mobile."', lastupdate = NOW() WHERE voucher=''
        $update = $db->query("UPDATE vouchers SET mobileno='" . $mobile . "', name='" . $name . "', lastupdate = NOW() WHERE voucher='" . $voucher[0]["voucher"] . "'");
        // send SMS
        $config = parse_ini_file(INIPATH);
        $sms = new SMS("https://konsoleh.your-server.de/");
        $domain = $config["smsdomain"];
        // e.g.: «my-domain.de» (without www!)
        $password = $config["smspassword"];
        // your FTP password (transmission is encrypted)
        $country = "+49";
        // country code (e.g. "+49" for Germany)
        $text = "Your voucher code is:" . $voucher[0]["voucher"];
        // the desired text (up to max. 160 characters)
        $sms->send($domain, $password, $country, $mobile, $text);
        // return true
        return true;
    } else {
        return false;
    }
}