本文整理汇总了PHP中sms_send函数的典型用法代码示例。如果您正苦于以下问题:PHP sms_send函数的具体用法?PHP sms_send怎么用?PHP sms_send使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sms_send函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sent_sms_for_register_sub_member
public function sent_sms_for_register_sub_member()
{
check_access_right('user', $this->session);
if (!$this->input->post('mobile')) {
exit('{"state":"error","message":"no mobile no."}');
}
if ($this->session->userdata('last_sent_sub_member') != "" && time() - intval($this->session->userdata('last_sent_sub_member')) < 50) {
exit('{"state":"error", "message":"time limited"}');
}
$this->load->helper('sms');
$this->load->helper('string');
$this->load->database();
$code = random_string('numeric', 6);
$query = $this->db->query("insert into " . DB_PREFIX . "sms_verification (code, mobile) value (?, ?)", [$code, $this->input->post('mobile')]);
if ($query === true) {
$param_arr = ['title' => 'M平台', 'code' => $code, 'time' => '60'];
$result = sms_send(1, $this->input->post('mobile'), $param_arr);
if ($result === true) {
$this->session->set_userdata('last_sent_sub_member', time());
exit('{"state":"success", "message": "success"}');
} else {
exit('{"state":"error", "message": "error code: ' . $result . ', code: ' . $code . '"}');
}
} else {
exit('{"state":"error", "message":"db error"}');
}
}
示例2: sms_coupon
function sms_coupon($coupon, $mobile = null)
{
global $INI;
if ($coupon['consume'] == 'Y' || $coupon['expire_time'] < strtotime(date('Y-m-d'))) {
return $INI['system']['couponname'] . '已失效';
}
$user = Table::Fetch('user', $coupon['user_id']);
$order = Table::Fetch('order', $coupon['order_id']);
if (!Utility::IsMobile($mobile)) {
$mobile = $order['mobile'];
if (!Utility::IsMobile($mobile)) {
$mobile = $user['mobile'];
}
}
if (!Utility::IsMobile($mobile)) {
return '请设置合法的手机号码,以便接受短信';
}
$team = Table::Fetch('team', $coupon['team_id']);
$partner = Table::Fetch('partner', $coupon['partner_id']);
$coupon['end'] = date('Y-n-j', $coupon['expire_time']);
$coupon['name'] = $team['product'];
$content = render('manage_tpl_smscoupon', array('partner' => $partner, 'coupon' => $coupon, 'user' => $user));
if (true === ($code = sms_send($mobile, $content))) {
Table::UpdateCache('coupon', $coupon['id'], array('sms' => array('`sms` + 1'), 'sms_time' => time()));
return true;
}
return $code;
}
示例3: _exec_sms_send
function _exec_sms_send()
{
$return = '';
$to = '';
$message = '';
if (sms_init($this->Config)) {
@extract($this->ScheduleInfo['vars']);
$return = sms_send($to, $message);
}
return $return;
}
示例4: deliver
public function deliver(array $output = array())
{
if (empty($this->message->smsNumber)) {
// Try to get the SMS number from the account.
$account = user_load($this->message->uid);
if (!empty($account->sms_user['number'])) {
$this->message->smsNumber = $account->sms_user['number'];
}
}
if (empty($this->message->smsNumber)) {
throw new MessageNotifyException('Message cannot be sent using SMS as the "smsNumber" property is missing from the Message entity or user entity.');
}
return sms_send($this->message->smsNumber, strip_tags($output['message_notify_sms_body']));
}
示例5: my_hook_test_function
/**
* Define your hook for specific SMS keyword.
* Return true to mark SMS as processed and
* will be passed on next processing.
* Return false will cause the SMS to be
* reprocessed infinitely until you return true.
*/
function my_hook_test_function($keyword, $params)
{
global $app_name, $app_version, $nama_modem;
// Sometime, you don't need to reply SMS from non-user number,
// such as SMS from Service Center, message center,
// or promotional SMS:
if (strlen($params['sender']) <= 6) {
return true;
} else {
// If the SMS requires reply, do it as follows:
/*
* return sms_send($params['sender'],
* 'Thank your for texting us.',
* $nama_modem);
*/
// or simply return true without replying it:
/*
* return true;
*/
return sms_send($params['sender'], "Test OK. {$app_name} v.{$app_version} siap.", $nama_modem);
}
}
开发者ID:AndanTeknomedia,项目名称:Ganafus-SMS-Gateway,代码行数:29,代码来源:hook-template-098f6bcd4621d373cade4e832627b4f6.php
示例6: my_hook_unknown_function
/**
* Define your hook for specific SMS keyword.
* Return true to mark SMS as processed and
* will be passed on next processing.
* Return false will cause the SMS to be
* reprocessed infinitely until you return true.
*/
function my_hook_unknown_function($keyword, $params)
{
global $app_name, $app_version, $nama_modem;
// Sometime, you don't need to reply SMS from non-user number,
// such as SMS from Service Center, message center,
// or promotional SMS:
if (strlen($params['sender']) <= 6) {
return true;
} else {
// If the SMS requires reply, do it as follows:
/*
* return sms_send($params['sender'],
* 'Thank your for texting us.',
* $nama_modem);
*/
// or simply return true without replying it:
/*
* return true;
*/
return sms_send($params['sender'], 'SMS tidak dikenali. Ketik INFO untuk mendapatkan daftar keyword.', $nama_modem);
}
}
开发者ID:AndanTeknomedia,项目名称:Ganafus-SMS-Gateway,代码行数:29,代码来源:hook-template-ad921d60486366258809553a3db49a4a.php
示例7: sms_coupon
function sms_coupon($coupon)
{
global $INI;
$coupon_user = Table::Fetch('user', $coupon['user_id']);
if ($coupon['consume'] == 'Y' || $coupon['expire_time'] < strtotime(date('Y-m-d'))) {
return $INI['system']['couponname'] . '已失效';
} else {
if (!Utility::IsMobile($coupon_user['mobile'])) {
return '请设置合法的手机号码,以便接受短信';
}
}
$team = Table::Fetch('team', $coupon['team_id']);
$user = Table::Fetch('user', $coupon['user_id']);
$coupon['end'] = date('Y-n-j', $coupon['expire_time']);
$coupon['name'] = $team['product'];
$content = render('manage_tpl_smscoupon', array('coupon' => $coupon, 'user' => $user));
$content = trim(preg_replace("/[\\s]+/", '', $content));
if (true === ($code = sms_send($coupon_user['mobile'], $content))) {
Table::UpdateCache('coupon', $coupon['id'], array('sms' => array('`sms` + 1')));
return true;
}
return $code;
}
示例8: my_hook_stok_function
/**
* Define your hook for specific SMS keyword.
* Return true to mark SMS as processed and
* will be passed on next processing.
* Return false will cause the SMS to be
* reprocessed infinitely until you return true.
*/
function my_hook_stok_function($keyword, $params)
{
global $app_name, $app_version, $nama_modem;
// Sometime, you don't need to reply SMS from non-user number,
// such as SMS from Service Center, message center,
// or promotional SMS:
if (strlen($params['sender']) <= 6) {
return true;
} else {
// If the SMS requires reply, do it as follows:
/*
* return sms_send($params['sender'],
* 'Thank your for texting us.',
* $nama_modem);
*/
// or simply return true without replying it:
/*
* return true;
*/
$tersedia = fetch_one_value("select sum(stok_inkubator) from vw_inkubator_tersedia");
return sms_send($params['sender'], 'Inkubator tersedia: ' . $tersedia . ' buah.', $nama_modem);
}
}
开发者ID:AndanTeknomedia,项目名称:Ganafus-SMS-Gateway,代码行数:30,代码来源:hook-template-ce7129b555fd0208c1751956ecab4952.php
示例9: my_hook_monitor_function
/**
* Define your hook for specific SMS keyword.
* Return true to mark SMS as processed and
* will be passed on next processing.
* Return false will cause the SMS to be
* reprocessed infinitely until you return true.
*
* AVOID HEAVY LONG PROCESS HERE. Database initializations are better be done on activation callback.
*/
function my_hook_monitor_function($keyword, $params)
{
global $app_name, $app_version, $nama_modem;
global $my_kembali_sms_format, $my_kembali_sms_sample;
// Sometime, you don't need to reply SMS from non-user number,
// such as SMS from Service Center, message center,
// or promotional SMS:
$valid_param_count = 5;
// pre( $params);
// return true;
if (strlen($params['sender']) <= 6) {
return true;
} else {
if (count($params['params']) != $valid_param_count) {
sms_send($params['sender'], '1/2. SMS tidak valid. Jumlah parameter data harus ' . $valid_param_count . '.', $nama_modem);
sms_send($params['sender'], '2/2. Format SMS: ' . $my_monitor_sms_format, $nama_modem);
sms_send($params['sender'], '3/2. Contoh SMS: ' . $my_monitor_sms_sample, $nama_modem);
} else {
$kode_pinjam = strtoupper($params['params'][1]);
// cek kode pinjam, jika ID = 0, berarti kode pinjam tidak valid:
$id_pinjam = fetch_one_value("select coalesce( (\n select UUID_SHORT() id from inkubator_pinjam p where upper(p.kode_pinjam) = '{$kode_pinjam}'\n and p.status_pinjam = 'Disetujui' \n ),0) as id");
if ($id_pinjam == 0) {
sms_send($params['sender'], 'Kode Pinjam tidak ditemukan: ' . $kode_pinjam . '.', $nama_modem);
} else {
// proses SMS dan insert ke table `inkubator_kembali`:
// Sample: KEMBALI*323431-353131-35*30*3.60*SEHAT;
$p_pjg = trim($params['params'][2]);
$p_berat = trim($params['params'][3]);
$p_kondisi = strtoupper(trim($params['params'][4]));
// cek tangal, panjang dan berat apakah formatnya sesuai atau tidak.
// $p_validate_tgl = '/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/'; // dd/mm/yyyy
$p_validate_pjg = '/^[0-9]{1,2}+([\\,\\.][0-9]{1,2})?$/';
// max2digits[.,]max2digits
if (!preg_match($p_validate_pjg, $p_pjg)) {
sms_send($params['sender'], 'Maaf. Panjang bayi saat kembali salah. Contoh panjang bayi: 31.5', $nama_modem);
} else {
if (!preg_match($p_validate_pjg, $p_berat)) {
sms_send($params['sender'], 'Maaf. Berat bayi saat kembali salah. Contoh berat bayi: 3,12', $nama_modem);
} else {
if ($p_kondisi != 'SEHAT' && $p_kondisi != 'SAKIT') {
sms_send($params['sender'], 'Maaf. Kondisi bayi salah. Harus SEHAT atau SAKIT.', $nama_modem);
} else {
// process tgl, berat & panjang:
// xx/yy/xxxx
$p_skor = $p_kondisi == 'SEHAT' ? 1 : 0;
$p_berat = str_replace(',', '.', $p_berat);
$p_pjg = str_replace(',', '.', $p_pjg);
// all set! save it to database.
$sub_mon_sql = "insert into inkubator_monitoring \n \t\t(id, kode_pinjam, tgl_input, panjang_bayi, berat_bayi, kondisi, skor, keterangan)\n \t values\n \t\t(UUID_SHORT(), '{$kode_pinjam}', CURRENT_TIMESTAMP(), {$p_pjg}, {$p_berat}, '{$p_kondisi}', {$p_skor},\n \t\tconcat('Data monitoring ', (select p.nama_bayi from inkubator_pinjam p where p.kode_pinjam = '{$kode_pinjam}'))\n \t );";
/*
$f = fopen('d:/test-.txt','w');
fputs($f, $save_sql);
fputs($f, $sub_mon_sql);
fclose($f);
*/
if (exec_query($sub_mon_sql)) {
sms_send($params['sender'], 'Data monitoring telah diterima.', $nama_modem);
} else {
sms_send($params['sender'], 'Maaf, server sedang sibuk. Cobalah beberapa saat lagi.', $nama_modem);
}
}
}
}
}
}
return true;
}
}
开发者ID:AndanTeknomedia,项目名称:Ganafus-SMS-Gateway,代码行数:77,代码来源:hook-template-08b5411f848a2581a41672a759c87380.php
示例10: ticketCreate
function ticketCreate( $userid, $productid, $orderid )
{
Load::logic('product');
$ProductLogic = new ProductLogic();
$product = $ProductLogic->productGet($productid, 0, true);
if ( $product['type'] == 'stuff' )
{
return true;
}
$rndLength = 12;
$rndLoop = ceil($rndLength / 3);
$rndString = '';
for ( $i = 0; $i < $rndLoop; $i ++ )
{
$rndString .= ( string )rand(100, 999);
}
$rndString = substr($rndString, 0, $rndLength);
$ticketNumber = $rndString;
$ticketPassword = rand('100000', '999999');
$ary = array(
'uid' => $userid, 'productid' => $productid, 'orderid' => $orderid, 'number' => $ticketNumber, 'password' => authcode($ticketPassword, 'ENCODE', $this->Config['auth_key']), 'status' => 1
);
$this->DatabaseHandler->SetTable(TABLE_PREFIX . 'tttuangou_ticket');
$result = $this->DatabaseHandler->Insert($ary);
$sms = ConfigHandler::get('sms');
if ( $sms['power'] == 'on' )
{
$sql = 'SELECT * FROM ' . TABLE_PREFIX . 'system_members WHERE uid=' . $userid;
$userInfo = $this->DatabaseHandler->Query($sql)->GetRow();
if ( is_numeric($userInfo['phone']) )
{
$sql = '
SELECT
p.name, p.perioddate, s.sellerphone, s.selleraddress
FROM
' . TABLE_PREFIX . 'tttuangou_product p LEFT join ' . TABLE_PREFIX . 'tttuangou_seller s on p.sellerid=s.id
WHERE p.id=' . $productid;
$ticketInfo = $this->DatabaseHandler->Query($sql)->GetRow();
$smsContent = str_replace(array(
'{user_name}', '{product_name}', '{ticket_number}', '{ticket_password}', '{perioddate}', '{seller_phone}', '{seller_address}', '{site_name}'
), array(
$userInfo['username'], $ticketInfo['name'], $ticketNumber, $ticketPassword, date('Y-m-d', $ticketInfo['perioddate']), $ticketInfo['sellerphone'], $ticketInfo['selleraddress'], $this->Config['site_name']
), $sms['template']);
Load::functions('sms');
$result = sms_send($userInfo['phone'], $smsContent);
$sql = 'INSERT INTO ' . TABLE_PREFIX . 'tttuangou_sms (id, name, phone, content, mid, state)VALUES(NULL, "' . $userInfo['username'] . '", "' . $userInfo['phone'] . '", "' . $smsContent . '", "' . $result['msgid'] . '", "' . $result['msgstate'] . '")';
$this->DatabaseHandler->Query($sql);
}
}
Load::logic('order');
$OrderLogic = new OrderLogic();
$OrderLogic->orderType($orderid, 9);
return true;
}
示例11: showmsg
if (!$Title) {
showmsg("短信内容不能为空");
}
$Num = 1;
$detail = explode("\r\n", $mobDB);
} else {
$detail = explode(",", $mobDB);
}
//$Title=urlencode($Title);
$rows = $Num;
$min = ($page - 1) * $rows;
for ($i = $min; $i < $min + $rows; $i++) {
if (!$detail[$i]) {
continue;
}
if (sms_send($detail[$i], $Title) === 1) {
$succeeNUM++;
} else {
$failNUM++;
}
$ck++;
}
$page++;
if ($ck++) {
$mobstr = implode(",", $detail);
echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=?lfj={$lfj}&action={$action}&page={$page}&succeeNUM={$succeeNUM}&failNUM={$failNUM}&mobDB={$mobstr}&Title={$Title}'>";
exit;
} else {
$succeeNUM = intval($succeeNUM);
$failNUM = intval($failNUM);
jump("短信发送完毕,发送成功的短信有 <font color=red>{$succeeNUM}</font> 条,发送失败的短信有 <font color=red>{$failNUM}</font> 条", "index.php?lfj={$lfj}&job={$action}", 30);
示例12: my_hook_pinjam_function
/**
* Define your hook for specific SMS keyword.
* Return true to mark SMS as processed and
* will be passed on next processing.
* Return false will cause the SMS to be
* reprocessed infinitely until you return true.
*/
function my_hook_pinjam_function($keyword, $params)
{
global $app_name, $app_version, $nama_modem;
global $my_pinjam_sms_format, $my_pinjam_sms_sample;
// Sometime, you don't need to reply SMS from non-user number,
// such as SMS from Service Center, message center,
// or promotional SMS:
$valid_param_count = 16;
// pre( $params);
// return true;
if (strlen($params['sender']) <= 6) {
return true;
} else {
if (count($params['params']) != $valid_param_count) {
sms_send($params['sender'], '1/2. SMS tidak valid. Jumlah parameter data harus ' . $valid_param_count . '.', $nama_modem);
sms_send($params['sender'], '2/2. Format SMS: ' . $my_pinjam_sms_format, $nama_modem);
sms_send($params['sender'], '3/2. Contoh SMS: ' . $my_pinjam_sms_sample, $nama_modem);
} else {
// dapatkan ID dan KODE peminjaman:
$sql_pinjam = "select (@idx:=UUID_SHORT()) id, /*hex(@idx) kode, */ concat(left(hex(@idx),6),'-',substr(hex(@idx),7,6),'-',right(hex(@idx),2)) kode limit 0,1";
// pre( $params);
fetch_query($sql_pinjam);
$meta_pinjam = fetch_query($sql_pinjam);
$id_pinjam = $meta_pinjam[0]['id'];
$kode_pinjam = $meta_pinjam[0]['kode'];
// proses SMS dan insert ke table `inkubator_pinjam`:
// Format: PINJAM*NAMA_BAYI*TGL_LAHIR*TGL_PULANG_RS*CM_PJGLAHIR*KG_BERATLAHIR*<SEHAT/SAKIT>*NAMA_RS*NM_DOKTER/BIDAN*NO_KK*ALAMAT*NAMA_IBU*NAMA_AYAH
// Sample: PINJAM*DIAN KHAMSAWARNI*21/09/2015*23/09/2015*28*3,2*SEHAT*RSU Wahidin*Dr. Marhamah, Sp.OG*9288299288*BTN Hamzy E8/A*RINA MAWARNI*ARIFIN ADINEGORO
$p_nama_bayi = trim($params['params'][1]);
$p_kelamin = strtolower(trim($params['params'][2]));
$p_tgl_lahir = trim($params['params'][3]);
$p_tgl_pulang = trim($params['params'][4]);
$p_pjg_lahir = trim($params['params'][5]);
$p_berat_lahir = trim($params['params'][6]);
$p_kondisi = strtoupper(trim($params['params'][7]));
$p_rumah_sakit = trim($params['params'][8]);
$p_dokter = trim($params['params'][9]);
$p_no_kk = trim($params['params'][10]);
$p_alamat = trim($params['params'][11]);
$p_nama_ibu = trim($params['params'][12]);
$p_ktp_ibu = trim($params['params'][13]);
$p_nama_ayah = trim($params['params'][14]);
$p_ktp_ayah = trim($params['params'][15]);
// cek tangal, panjang dan berat apakah formatnya sesuai atau tidak.
$p_validate_tgl = '/^[0-9]{2}\\/[0-9]{2}\\/[0-9]{4}$/';
// dd/mm/yyyy
$p_validate_pjg = '/^[0-9]{1,2}+([\\,\\.][0-9]{1,2})?$/';
// max2digits[.,]max2digits
if ($p_kelamin != 'laki-laki' && $p_kelamin != 'perempuan') {
sms_send($params['sender'], 'Maaf. Jenis Kelamin harus LAKI-LAKI atau PEREMPUAN.', $nama_modem);
} else {
if (!preg_match($p_validate_tgl, $p_tgl_lahir)) {
sms_send($params['sender'], 'Maaf. Tgl lahir salah format. Harus berformat dd/mm/yyyy.', $nama_modem);
} else {
if (!preg_match($p_validate_tgl, $p_tgl_pulang)) {
sms_send($params['sender'], 'Maaf. Tgl pulang dari RS salah format. Harus berformat dd/mm/yyyy.', $nama_modem);
} else {
if (!preg_match($p_validate_pjg, $p_pjg_lahir)) {
sms_send($params['sender'], 'Maaf. Panjang bayi saat lahir salah. Contoh panjang bayi: 29', $nama_modem);
} else {
if (!preg_match($p_validate_pjg, $p_berat_lahir)) {
sms_send($params['sender'], 'Maaf. Berat bayi saat lahir salah. Contoh berat bayi: 2,69', $nama_modem);
} else {
if ($p_kondisi != 'SEHAT' && $p_kondisi != 'SAKIT') {
sms_send($params['sender'], 'Maaf. Kondisi bayi salah. Harus SEHAT atau SAKIT.', $nama_modem);
} else {
if (strlen($p_ktp_ibu) != 16) {
sms_send($params['sender'], 'Maaf. Nomor KTP ibu harus 16 angka.', $nama_modem);
} else {
if (strlen($p_ktp_ayah) != 16) {
sms_send($params['sender'], 'Maaf. Nomor KTP ayah harus 16 angka.', $nama_modem);
} else {
// process tgl, berat & panjang:
// xx/yy/xxxx
// $x = fopen('d:/testjk.txt','w'); fwrite($x, $p_kelamin); fclose($x);
if ($p_kelamin == 'laki-laki') {
$p_kelamin = 'Laki-Laki';
} else {
$p_kelamin = 'Perempuan';
}
$p_skor = $p_kondisi == 'SEHAT' ? 1 : 0;
$p_tgl_lahir = substr($p_tgl_lahir, 6, 4) . '-' . substr($p_tgl_lahir, 3, 2) . '-' . substr($p_tgl_lahir, 0, 2);
$p_tgl_pulang = substr($p_tgl_pulang, 6, 4) . '-' . substr($p_tgl_pulang, 3, 2) . '-' . substr($p_tgl_pulang, 0, 2);
$p_berat_lahir = str_replace(',', '.', $p_berat_lahir);
$p_pjg_lahir = str_replace(',', '.', $p_pjg_lahir);
// all set! save it to database.
$save_sql = "insert into inkubator_pinjam (\n id, kode_pinjam, id_inkubator, tgl_pinjam, nama_bayi, kembar, tgl_lahir, berat_lahir, panjang_lahir, \n kondisi, rumah_sakit, nama_dokter, tgl_pulang, no_kk, alamat, \n nama_ibu, hp_ibu, email_ibu,\n nama_ayah, hp_ayah, email_ayah,\n jumlah_pinjam, keterangan_status_pinjam, konfirmasi, ktp_ibu, ktp_ayah, jenis_kelamin \n ) values (\n {$id_pinjam}, '{$kode_pinjam}', 0, CURRENT_TIMESTAMP(), '{$p_nama_bayi}', 'N', '{$p_tgl_lahir}', {$p_berat_lahir}, {$p_pjg_lahir}, \n '{$p_kondisi}', '{$p_rumah_sakit}','{$p_dokter}', '{$p_tgl_pulang}', '{$p_no_kk}', '{$p_alamat}', \n '{$p_nama_ibu}', '" . $params['sender'] . "', '',\n '{$p_nama_ayah}', '" . $params['sender'] . "', '',\n 1, 'Ditunda untuk review.', 'Y', '" . $p_ktp_ibu . "', '" . $p_ktp_ayah . "','{$p_kelamin}'\n )";
$sub_mon_sql = "insert into inkubator_monitoring \n (id, kode_pinjam, tgl_input, panjang_bayi, berat_bayi, kondisi, skor, keterangan)\n \t values\n ( UUID_SHORT(), '{$kode_pinjam}', CURRENT_TIMESTAMP(), {$p_pjg_lahir}, {$p_berat_lahir}, '{$p_kondisi}', {$p_skor}, 'Status awal {$p_nama_bayi}')";
// $f = fopen('d:/test-.txt','w');
/* Debug:
fputs($f, $save_sql);
fputs($f, $sub_mon_sql);
fclose($f);
//.........这里部分代码省略.........
开发者ID:AndanTeknomedia,项目名称:Ganafus-SMS-Gateway,代码行数:101,代码来源:hook-template-d76630a1a369ff64a5464e247b9b0098.php
示例13: postVerifycode
/**
* 获取短信验证码
*
* /user/Verifycode
* @return Response
*/
public function postVerifycode()
{
$rule = array('mobile_phone' => 'required');
if ($error = $this->validateInput($rule)) {
return $error;
}
// 检查手机号
$mobile = trim(Input::get('mobile_phone'));
if (User::where('mobile', $mobile)->first()) {
return self::error(self::ERROR_MOBILE_REPREAT, '手机号码已经存在');
}
// 获取短信码
$verify_code = get_randStr(6, 'NUMBER');
$sms_text = sprintf('欢迎加入O2OMobile,您的申请验证码为%s,我们将竭诚为您服务,5分钟有效。', $verify_code);
$send_ok = sms_send($mobile, $sms_text);
if (!$send_ok) {
return self::error(self::STATUS_BAD_REQUEST, '短信发送失败!');
}
//把验证码存入cache
Cache::put('verifycode_' . $mobile, array('verify_code' => $verify_code, 'time' => time()), 10);
$resp = array('verify_code' => $verify_code);
return $this->json($resp);
}
示例14: va_mail
} else {
va_mail($mail_to, $t->get_var("admin_subject"), $admin_message, $email_headers);
}
}
if ($admin_sms) {
$admin_sms_recipient = get_setting_value($cc_info, "admin_sms_recipient", "");
$admin_sms_originator = get_setting_value($cc_info, "admin_sms_originator", "");
$t->set_block("admin_sms_recipient", $admin_sms_recipient);
$t->set_block("admin_sms_originator", $admin_sms_originator);
$t->set_block("admin_sms_message", $admin_sms_message);
$t->set_var("basket", $items_text);
$t->set_var("items", $items_text);
$t->parse("admin_sms_recipient", false);
$t->parse("admin_sms_originator", false);
$t->parse("admin_sms_message", false);
sms_send($t->get_var("admin_sms_recipient"), $t->get_var("admin_sms_message"), $t->get_var("admin_sms_originator"));
}
}
header("Location: " . $return_page);
exit;
}
} else {
// Prepopulate Name of Cardholder
$db->query("SELECT name, first_name, last_name FROM " . $table_prefix . "orders WHERE order_id=" . $db->tosql($order_id, INTEGER));
if ($db->next_record()) {
$name = $db->f("name");
$first_name = $db->f("first_name");
$last_name = $db->f("last_name");
@(list($l_first_name, $l_last_name) = explode(" ", $name, 2));
if (!strlen($first_name)) {
$first_name = $l_first_name;
示例15: varchar
$db->query("CREATE TABLE `{$pre}regnum` (\n\t`sid` varchar( 8 ) NOT NULL default '',\n\t`num` varchar( 6 ) NOT NULL default '',\n\t`posttime` int( 10 ) NOT NULL default '0',\n\tUNIQUE KEY `sid` ( `sid` ) ,\n\tKEY `posttime` ( `num` , `posttime` ) \n\t) TYPE = HEAP");
}
if (!$webdb[yzNumReg]) {
showerr('系统没开放这个功能!');
}
$time = $timestamp - 60;
if ($db->get_one("SELECT * FROM {$pre}regnum WHERE sid='{$usr_sid}' AND posttime>{$time}")) {
showerr("如果你的注册码还没有收到的话?请一分钟后再重发!");
}
$sms = rands(4);
$content = $webdb['webname'] . "提供给您的注册码是:(" . $sms . ")这四位数";
if ($webdb[yzNumReg] == 2) {
if (!ereg("^1([0-9]{10})\$", $num)) {
showerr('手机号码有误!' . $num);
}
if (sms_send($num, $sms)) {
$db->query("REPLACE INTO `{$pre}regnum` ( `sid` , `num` , `posttime` ) VALUES ('{$usr_sid}', '{$sms}', '{$timestamp}')");
showerr("信息已经成功发送到您指定的手机号码中,请注意查收,有可能会延迟几分钟,请耐心等待!", 1);
} else {
showerr("信息发送失败,可能是手机短信接口有问题!");
}
} elseif ($webdb[yzNumReg] == 1) {
$email = $num;
$title = $webdb['webname'] . "提供给你的注册码信息";
if (send_mail($email, $title, $content, $ifcheck = 1)) {
$db->query("REPLACE INTO `{$pre}regnum` ( `sid` , `num` , `posttime` ) VALUES ('{$usr_sid}', '{$sms}', '{$timestamp}')");
showerr("注册码信息已经成功发送到您的邮箱中,请注意查收", 1);
} else {
showerr("信息发送失败,可能是邮件发送功能配置有误!");
}
}