当前位置: 首页>>代码示例>>PHP>>正文


PHP Formatter::isVinaphoneNumber方法代码示例

本文整理汇总了PHP中Formatter::isVinaphoneNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::isVinaphoneNumber方法的具体用法?PHP Formatter::isVinaphoneNumber怎么用?PHP Formatter::isVinaphoneNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Formatter的用法示例。


在下文中一共展示了Formatter::isVinaphoneNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex

 public function actionIndex()
 {
     $return = array('error' => 0, 'msg' => '');
     if (Yii::app()->request->isPostRequest) {
         $phone = Formatter::formatPhone($_POST['phone']);
         if (Formatter::isVinaphoneNumber($phone)) {
             if (!isset($_COOKIE["verifyWifiEvent"])) {
                 if (isset($_SESSION['countverifyWifiEvent'])) {
                     unset($_SESSION['countverifyWifiEvent']);
                 }
                 $_SESSION['countverifyWifiEvent'] = 1;
                 $_SESSION['phoneverifyWifiEvent'] = $phone;
                 setcookie("verifyWifiEvent", 1, time() + 600);
             } else {
                 $_SESSION['countverifyWifiEvent']++;
                 if ($_SESSION['countverifyWifiEvent'] > 3) {
                     $return['error'] = 1;
                     $return['msg'] = "Quí khách đã vượt quá số lần xác thực. Vui lòng thử lại sau ít phút.";
                 }
             }
             if ($return['error'] == 0) {
                 try {
                     $userVerify = UserVerifyModel::model()->findByAttributes(array('msisdn' => $phone, 'action' => 'register_event83'));
                     if (!empty($userVerify)) {
                         $verifyCode = $userVerify->verify_code;
                     } else {
                         $verifyCode = rand(1000, 9999);
                         $verifyModel = new UserVerifyModel();
                         $verifyModel->setAttribute('created_time', date("Y-m-d H:i:s"));
                         $verifyModel->setAttribute('msisdn', $phone);
                         $verifyModel->setAttribute('verify_code', $verifyCode);
                         $verifyModel->setAttribute('action', 'register_event83');
                         $verifyModel->save();
                     }
                     $sms = new SmsClient();
                     $content = "Ma xac thuc dang ky tren chacha la: " . $verifyCode;
                     $sms->sentMT("9234", $phone, 0, $content, 0, "", time(), 9234);
                     $this->redirect('/event/register/verifyWifi');
                 } catch (Exception $exc) {
                     echo $exc->getTraceAsString();
                 }
             }
         } else {
             $return['error'] = 2;
             $return['msg'] = "Số điện thoại của bạn không phải là thuê bao Vinaphone!";
         }
     }
     $this->render('index', array('return' => $return));
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:49,代码来源:RegisterController.php

示例2: actionSubscribe

 public function actionSubscribe()
 {
     /*if(!isset($_SERVER['SERVER_NAME']) || $_SERVER['SERVER_NAME'] != 'msisdn.chacha.vn'){
           $this->redirect('/site/error404');
       }*/
     $userPhone = Yii::app()->user->getState('msisdn');
     $userSub = $this->userSub;
     //WapUserSubscribeModel::model()->findByAttributes(array('user_phone' => $userPhone, 'status' => UserSubscribeModel::ACTIVE));
     $confirm = Yii::app()->request->getParam('confirm', 0);
     $source = Yii::app()->request->getParam('source', 'buzzcity');
     $source = strtoupper($source);
     $result = null;
     $userObj = null;
     if ($confirm == 0) {
         $write = 1;
         if (isset($_SESSION[$source])) {
             // check time giua 2 lan visit co > 15 giay hay ko
             $latest_time = $_SESSION[$source];
             $now = date("Y-m-d H:i:s");
             $diff = strtotime($now) - strtotime($latest_time);
             if (intval($diff) < 15) {
                 $write = 0;
             }
         }
         if ($write == 1) {
             // log to table log_ads_click
             $log = new LogAdsClickModel();
             $ip = $_SERVER["REMOTE_ADDR"];
             $is3G = 0;
             if (Yii::app()->user->getState('is3G')) {
                 $is3G = 1;
             }
             $log->logAdsWap($userPhone, $source, $ip, $is3G);
             // set session value
             $_SESSION[$source] = date("Y-m-d H:i:s");
         }
     }
     $destUrl = Yii::app()->request->getParam('url', Yii::app()->homeUrl);
     //$destUrl = urldecode($destUrl);
     if ($userSub) {
         $this->redirect($destUrl);
     }
     $isPromotion = WapUserSubscribeModel::model()->checkPromotion($userPhone);
     if ($isPromotion) {
         $confirm = 1;
     }
     if ($confirm == 1) {
         try {
             $phone = $userPhone;
             if (!isset($phone) || !Formatter::isVinaphoneNumber($phone)) {
                 $result = new stdClass();
                 $result->errorCode = 401;
                 $result->message = WapUserSubscribeModel::model()->getCustomMetaData('3G_TEXT');
             } else {
                 //anti flood request
                 if (!isset($_SESSION)) {
                     session_start();
                 }
                 //time_nanosleep(0, 500000000);
                 $token = Yii::app()->request->csrfToken;
                 $ssid = session_id();
                 $sql = "INSERT INTO user_phone_subscribe_unduplicate(phone,ssid,token,created_time,status)\n\t\t\t\t\tVALUE('{$userPhone}','{$ssid}','{$token}',NOW(),0)\n\t\t\t\t\t";
                 $connDB = VegaCommonFunctions::getConnectMysql();
                 $res1 = mysql_query($sql);
                 mysql_close($connDB);
                 if ($res1) {
                     $bmUrl = yii::app()->params['bmConfig']['remote_wsdl'];
                     $client = new SoapClient($bmUrl, array('trace' => 1));
                     $params = array('phone' => $userPhone, 'package' => 'CHACHAFUN', 'source' => 'wap', 'promotion' => '', 'bundle' => 0, 'smsId' => null, 'note_event' => $source);
                     $result = $client->__soapCall('userRegister', $params);
                     $timeClear = date('Y-m-d H:i:s', time() - 60 * 5);
                     $sql = "DELETE FROM user_phone_subscribe_unduplicate WHERE created_time<='{$timeClear}'";
                     $res2 = Yii::app()->db->createCommand($sql)->execute();
                 } else {
                     $log = new KLogger("SUBS_DUPLICATE_EXCEPTION", KLogger::INFO);
                     $log->LogInfo("Ex:" . $userPhone, false);
                     $this->redirect($destUrl);
                     exit;
                 }
             }
             if ($result->errorCode == 0 || $result->errorCode == '0') {
                 //$userObj = WapUserSubscribeModel::model()->findByAttributes(array('user_phone' => $userPhone));
                 if ($isPromotion) {
                     Yii::app()->user->setState('DK_MA_MSG', 'Quý khách có 7 ngày vàng trải nghiệm dịch vụ: Nghe, xem, tải MIỄN PHÍ toàn bộ nội dung và miễn cước data (3G/GPRS~30.000đ/ngày).Tặng kèm gói miễn phí tải nhạc chuông và quà tặng âm nhạc. Để từ chối nhận KM Quý khách soạn HUY CHACHA gửi 9234');
                 }
                 $this->redirect($destUrl);
             }
         } catch (Exception $e) {
             $log = new KLogger("SUBS_EXCEPTION", KLogger::INFO);
             $log->LogInfo("Ex:" . $e->getMessage(), false);
             //Yii::log($e->getMessage(), "error", "exeption.BMException");
             $this->redirect($destUrl);
             exit;
         }
     } else {
         $log = new KLogger("SUBS_NOT_PROMOTION", KLogger::INFO);
         $log->LogInfo($userPhone, false);
     }
     $this->renderPartial("subscribe_adv", array('userObj' => $userObj, 'result' => $result, 'confirm' => $confirm, 'source' => strtolower($source), 'isPromotion' => $isPromotion, 'destUrl' => $destUrl));
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:100,代码来源:AccountController.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new PhoneModel();
     $message = "";
     $errorList = array();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['source_name'], $_POST['group_id'])) {
         $fileName = _APP_PATH_ . DS . "data" . DS . "tmp" . DS . $_POST['source_name'];
         $group_id = $_POST['group_id'];
         //$fileName = "D:\\chacha_cloud\\src\\trunk\chacha\data\\tmp\\20120713170547_phone_list.xls";
         try {
             require_once 'excel_reader2.php';
             $data = new Spreadsheet_Excel_Reader($fileName, true, "UTF-8");
             // khoi tao doi tuong doc file excel
             $rowsnum = $data->rowcount($sheet_index = 0);
             // lay so hang cua sheet
             $colsnum = $data->colcount($sheet_index = 0);
             // lay so cot cua sheet
             for ($i = 2; $i <= $rowsnum; $i++) {
                 // doc tu hang so 2 vi hang 1 la tieu de roi!
                 $phoneNum = $data->val($i, 1);
                 // xuat cot so 1 va cot so 2 tren cung 1 hang
                 // check so dien thoai xem co dung cua Vinaphone ko
                 try {
                     $phoneNum = Formatter::formatPhone($phoneNum);
                     if (Formatter::isVinaphoneNumber($phoneNum)) {
                         $model->phone = "{$phoneNum}";
                         $model->group_id = $group_id;
                         $model->status = 0;
                         $model->created_time = date("Y-m-d H:i:s");
                         var_dump($model->phone);
                         try {
                             if ($model->save()) {
                                 $message = yii::t('SpamModule', 'Upload thành công');
                             } else {
                                 print_r($model->getErrors());
                                 exit;
                             }
                         } catch (Exception $exc) {
                             echo $exc->getTrace();
                         }
                     } else {
                         //echo so dien thoai ko dung
                         $errorList[] = $phoneNum;
                     }
                 } catch (Exception $exc) {
                     echo $exc->getMessage();
                 }
             }
         } catch (Exception $exc) {
             echo $exc->getMessage();
         }
     }
     $uploadModel = new XUploadForm();
     $tmpArr = GroupModel::model()->findAll();
     $smsGroup = array();
     foreach ($tmpArr as $smsG) {
         $smsGroup[$smsG->id] = $smsG->name;
     }
     $this->render('create', array('model' => $model, 'uploadModel' => $uploadModel, 'message' => $message, 'smsGroup' => $smsGroup, 'errorList' => $errorList));
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:66,代码来源:PhoneController.php

示例4: actionUpload

 /**
  * @author tannew
  * Upload phone numbers to Group
  */
 public function actionUpload()
 {
     $message = "";
     $errorList = array();
     // list of invalid Vinaphone phone
     $dupList = array();
     //  list of duplicated phone
     $subscribeList = array();
     // list subscribed phone
     $arrayVal = array();
     $arr_filter = array();
     $id = $_POST['group_id'];
     $source_file = $_POST['source_name'];
     //ten file excel
     $arr_filter['register_phone_filter'] = $_POST['register_phone_filter'];
     //checkbox: Kiem tra nhung so DT da dang ki
     $arr_filter['exist_group_filter'] = $_POST['exist_group_filter'];
     //checkbox: Loai bo nhung so DT da thuoc group khac
     $arr_filter['group_list'] = $_POST['group_list'];
     // danh sach cac Group muon loai bo cac so DT da thuoc chung
     $arr_filter['date_filter'] = $_POST['date_filter'];
     // text: Loc theo ngay
     $arr_filter['km_filter'] = $_POST['km_filter'];
     // chi lay nhung so DT dc huong KM de add vao group
     $group_id = $id;
     if (isset($source_file, $id)) {
         $fileName = _APP_PATH_ . DS . "public/admin/data" . DS . "tmp" . DS . $source_file;
         try {
             require_once 'excel_reader2.php';
             $data = new Spreadsheet_Excel_Reader($fileName, true, "UTF-8");
             // khoi tao doi tuong doc file excel
             $rowsnum = $data->rowcount($sheet_index = 0);
             // lay so hang cua sheet
             for ($i = 1; $i <= $rowsnum; $i++) {
                 // doc tu hang so 2 vi hang 1 la tieu de roi!
                 $phoneNum = $data->val($i, 1);
                 // xuat cot so 1 va cot so 2 tren cung 1 hang
                 try {
                     $phoneNum = Formatter::formatMSISDN($phoneNum, "84,0", "84");
                     if (Formatter::isVinaphoneNumber($phoneNum)) {
                         $created_time = date("Y-m-d H:i:s");
                         $exist = PhoneModel::model()->exists('group_id = :group_id AND phone= :phone', array(':phone' => $phoneNum, ':group_id' => $id));
                         if ($exist == false) {
                             try {
                                 $arrayVal[] = "('{$phoneNum}',{$group_id},0,'{$created_time}')";
                             } catch (Exception $exc) {
                                 echo $exc->getMessage();
                             }
                         } else {
                             $dupList[] = $phoneNum;
                         }
                     } else {
                         $errorList[] = $phoneNum;
                     }
                 } catch (Exception $exc) {
                     echo $exc->getMessage();
                 }
             }
             /**
              * Start insert here: split each 200 phone
              */
             $arrs = array_chunk($arrayVal, 200);
             foreach ($arrs as $arr) {
                 $vals = implode(",", $arr);
                 $sql = "INSERT INTO spam_sms_phone (`phone`,`group_id`,`status`,`created_time`) VALUES {$vals}";
                 $command = Yii::app()->db->createCommand($sql);
                 $command->execute();
             }
         } catch (Exception $exc) {
             echo $exc->getMessage();
         }
     }
     // delete phone in blacklist
     $sql = "DELETE spam_sms_phone.* FROM spam_sms_phone INNER JOIN deleted_phone on deleted_phone.phone = spam_sms_phone.phone WHERE spam_sms_phone.group_id = :gid";
     $command = Yii::app()->db->createCommand($sql);
     $command->bindParam(":gid", $group_id);
     $command->execute();
     // Delete phone from spam_sms_reject_phone
     $sql = "DELETE spam_sms_phone.* FROM spam_sms_phone INNER JOIN spam_sms_reject_phone t2 on t2.phone = spam_sms_phone.phone WHERE spam_sms_phone.group_id = :gid";
     $command = Yii::app()->db->createCommand($sql);
     $command->bindParam(":gid", $group_id);
     $command->execute();
     // C1: delete phone Ko dc huong KM if km_filter = 1
     if ($arr_filter['km_filter'] == "1") {
         $sql = "DELETE spam_sms_phone.* FROM spam_sms_phone INNER JOIN user_subscribe_km on user_subscribe_km.phone = spam_sms_phone.phone WHERE spam_sms_phone.group_id = :gid and (user_subscribe_km.type = 0 OR (user_subscribe_km.type = 1 AND user_subscribe_km.created_time >= date_sub(NOW(), interval 720 hour)))";
         $command = Yii::app()->db->createCommand($sql);
         $command->bindParam(":gid", $group_id);
         $command->execute();
     }
     // C3: remove all Phone in selected groups
     if ($arr_filter['exist_group_filter'] == "1") {
         if (!empty($arr_filter['group_list']) && count($arr_filter['group_list']) > 0) {
             $listGroup = implode(',', $arr_filter['group_list']);
             $sql = "DELETE s1.* FROM spam_sms_phone s1 INNER JOIN spam_sms_phone s2 ON s1.phone = s2.phone WHERE s1.group_id = :gid and s2.group_id IN (:listId)";
             $command = Yii::app()->db->createCommand($sql);
             $command->bindParam(":gid", $group_id);
//.........这里部分代码省略.........
开发者ID:giangnh264,项目名称:mobileplus,代码行数:101,代码来源:GroupController.php

示例5: actionShare

 public function actionShare()
 {
     $userPhone = yii::app()->user->getState('msisdn');
     $isShare = GameEventActivityModel::isShareOnDay($userPhone, date('Y-m-d'));
     if ($isShare) {
         $this->redirect('/event/play/thank');
         Yii::app()->end();
     }
     $error = 0;
     $isSend = false;
     if (Yii::app()->request->isPostRequest) {
         $isSend = 0;
         $phoneList = $_POST['phone_list'];
         if ($phoneList != '') {
             $phoneArr = explode(',', $phoneList);
             if ($phoneArr) {
                 foreach ($phoneArr as $key => $value) {
                     $phone = Formatter::formatPhone($value);
                     if (Formatter::isVinaphoneNumber($phone)) {
                         $isSend++;
                         $sms = new SmsClient();
                         $content = 'DV Chacha - Vinaphone kinh chao Quy Khach. Quy Khach vua duoc thue bao ' . $userPhone . ' moi dua tai trong chuong trinh "Vui cung Chacha - Nhan qua nhu y" voi giai thuong hap dan len toi 20 trieu dong. Chi tiet moi Quy Khach xem tai day http://m.chacha.vn/event';
                         $sms->sentMT("9234", $phone, 0, $content, 0, "", time(), 9234);
                     }
                 }
                 if ($isSend > 0) {
                     //chia se it nhat duoc 1 so vinaphone
                     $gameActivity = new GameEventActivityModel();
                     $gameActivity->setAttribute('user_phone', $userPhone);
                     $gameActivity->setAttribute('activity', 'share');
                     $gameActivity->setAttribute('point', 1);
                     $gameActivity->setAttribute('updated_time', date('Y-m-d H:i:s'));
                     $gameActivity->setAttribute('note', $phoneList, PDO::PARAM_STR);
                     $gameActivity->save();
                     $this->redirect('/event/play/thank');
                 }
             }
         } else {
             //ko có sô dt nao
             $error = 1;
         }
     }
     $this->render('share', array('isShare' => $isShare, 'error' => $error, 'isSend' => $isSend));
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:44,代码来源:PlayController.php


注:本文中的Formatter::isVinaphoneNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。