本文整理汇总了PHP中sendsms函数的典型用法代码示例。如果您正苦于以下问题:PHP sendsms函数的具体用法?PHP sendsms怎么用?PHP sendsms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendsms函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendphone
public function sendphone()
{
$phone = htmlspecialchars($_POST['cellphone']);
$code = rand_string_reg(6, 1, 2);
$result = sendsms($phone, '验证码为:' . $code);
$this->ajaxReturn(array('status' => $result));
}
示例2: get_response
public function get_response()
{
//传入的用户名和密码
$uname = trim($this->request_arr['phone']);
if (preg_match("/^1[34578]\\d{9}\$/", $uname)) {
$this->numberTab = 'lzh_members';
$ok = $this->isRegisted($uname);
if ($ok) {
$smscode = rand(1000, 9999);
$sql = sprintf("select telephone,cur_time from `%s` where telephone='%s' limit 1;", $this->tbl_findpwd, $uname);
$dbc = core::db()->getConnect('DTS');
$cut = $dbc->query($sql);
$p = $dbc->fetchArray($cut);
//[0]['telephone'];
$oldtime = $p['cur_time'] + $validTime;
$time = time();
if ($p['telephone'] == $uname) {
$sql = sprintf("update `%s` set `telephone`='%s',`vcode`='%s',`cur_time`='%s' where `telephone`='%s'", $this->tbl_findpwd, $uname, $smscode, $time, $uname);
} else {
$sql = sprintf('insert into `%s`(`telephone`,`vcode`,`cur_time`) values("%s","%s","%s")', $this->tbl_findpwd, $uname, $smscode, $time);
}
$stat = $dbc->query($sql);
if ($stat) {
$res = sendsms($uname, '您的注册短信验证码为' . $smscode . ',30分钟内有效!');
exit(json_encode(array('code' => 66, 'msg' => "成功", 'stat' => true)));
} else {
exit(json_encode(array('code' => 67, 'msg' => "写入数据库失败", 'stat' => false)));
}
} else {
exit(json_encode(array('code' => 25, 'msg' => "手机号没有注册", 'stat' => false)));
}
}
}
示例3: sendPublic
public function sendPublic()
{
$reserve = D('reserve');
if (IS_POST) {
$ids = I('post.id');
$map['status'] = 1;
$list = M("reserve")->where($map)->select();
$count = M("reserve")->where($map)->count();
if ($list) {
foreach ($list as $key => $val) {
$mobile = $val["cellphone"];
$content = "您预约的" . $val["title"] . ",即将开始,谢谢-" . C('SITENAME');
sendsms($mobile, $content);
$id = $val['id'];
$data['status'] = 2;
$n = M("reserve")->where("id='{$id}'")->save($data);
}
}
if ($n == $count) {
$this->success("发送成功!");
} else {
$this->success("发送失败!" . $count);
}
}
}
示例4: updateProfile
function updateProfile($fname, $lname, array $dnrr)
{
#echo "$authkey <br>$fname <br/>$lname <br/> $email <br> $photo<br>";
$msg = "Join me on Fuse platform the best way to connect with people real time";
$snrr = $fname . $lname;
sendsms($snrr, $dnrr, $msg);
}
示例5: sms_autosend_hook_playsmsd
function sms_autosend_hook_playsmsd()
{
global $core_config;
$timenow = mktime();
$db_query = "SELECT uid,time_id," . _DB_PREF_ . "_featureAutosend.autosend_id, autosend_message,autosend_number,autosend_time\n\t\t\t\t\t\t\tFROM " . _DB_PREF_ . "_featureAutosend\n\t\t\t\t\t\t\tINNER JOIN " . _DB_PREF_ . "_featureAutosend_time\n\t\t\t\t\t\t\tON " . _DB_PREF_ . "_featureAutosend.autosend_id = " . _DB_PREF_ . "_featureAutosend_time.autosend_id\n\t\t\t\t\t\t\tWHERE UNIX_TIMESTAMP(" . _DB_PREF_ . "_featureAutosend_time.autosend_time) <= '{$timenow}'\n\t\t\t\t\t\t\tAND " . _DB_PREF_ . "_featureAutosend_time.sent='0'\n\t\t\t\t\t\t\tAND autosend_time != ''\n\t\t\t\t\t\t\tAND " . _DB_PREF_ . "_featureAutosend.autosend_enable='1'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$message = $db_row['autosend_message'];
$c_uid = $db_row['uid'];
$username = uid2username($c_uid);
$sms_to = $db_row['autosend_number'];
// we are sending to this number
$autosend_id = $db_row['autosend_id'];
$time_id = $db_row['time_id'];
$unicode = 0;
if (function_exists('mb_detect_encoding')) {
$encoding = mb_detect_encoding($message, 'auto');
if ($encoding != 'ASCII') {
$unicode = 1;
}
}
// list($ok,$to,$smslog_id) = sendsms_pv($username, $sms_to, $message);
$ret = sendsms($core_config['main']['cfg_gateway_number'], '', $sms_to, $message, $c_uid, 0, 'text', $unicode);
// $ok = $ok[0];
$ok = $ret['status'];
if ($ok) {
$db_query = "UPDATE " . _DB_PREF_ . "_featureAutosend_time SET sent='1' WHERE time_id = '{$time_id}'";
$db_result = @dba_affected_rows($db_query);
}
}
}
示例6: global_footer
function global_footer()
{
global $_G;
if (!$this->allow) {
return;
}
require_once DISCUZ_ROOT . './source/plugin/smstong/smstong.func.php';
$data = DB::fetch_first("SELECT mobile FROM " . DB::table("common_member_profile") . " WHERE uid = {$_G['uid']}");
if ($_G['cache']['plugin']['smstong']['reportmsgnotify'] && $_G['gp_mod'] == 'report' && $_G['gp_reportsubmit']) {
$content = $_G['cache']['plugin']['smstong']['reportmsgnotifymsg'];
$rp = array('$username', '$tid', '$message');
$sm = array($_G['username'], $_G['gp_rid'], $_G['gp_message']);
$content = str_replace($rp, $sm, $content);
$arraymobile = explode(',', $_G['cache']['plugin']['smstong']['reportmsgnotifymobile']);
foreach ($arraymobile as $mobile) {
$ret = sendsms($_G['cache']['plugin']['smstong']['smsusername'], $_G['cache']['plugin']['smstong']['smspassword'], $mobile, $content);
}
} elseif ($_G['cache']['plugin']['smstong']['loggingmsgnotify'] && ismobile($data['mobile']) && $_G['cookie']['loginmark'] != $_G['cookie']['lastvisit']) {
dsetcookie('loginmark', $_G['cookie']['lastvisit']);
require_once DISCUZ_ROOT . './source/function/function_misc.php';
$content = $_G['cache']['plugin']['smstong']['loggingmsgnotifymsg'];
$rp = array('$username', '$logtime', '$ipaddress', '$location');
$sm = array($_G['username'], date('Y-m-d H:i:s', TIMESTAMP), $_G['clientip'], str_replace('-', '', str_replace(' ', '', convertip($_G['clientip']))));
$content = str_replace($rp, $sm, $content);
$ret = sendsms($_G['cache']['plugin']['smstong']['smsusername'], $_G['cache']['plugin']['smstong']['smspassword'], $data['mobile'], $content);
}
}
示例7: myauto_hook_interceptincomingsms
function myauto_hook_interceptincomingsms($sms_datetime, $sms_sender, $message, $sms_receiver)
{
global $core_config;
// reply message
$reply = 'Thank you for your message';
// detect reply message, set unicode if not ASCII
$unicode = core_detect_unicode($reply);
// send reply
list($ok, $to, $smslog_id, $queue) = sendsms('admin', $sms_sender, $reply, 'text', $unicode);
// log it
$sms_datetime = core_display_datetime($sms_datetime);
logger_print("dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " autorespon:" . $reply, 2, "myauto");
}
示例8: repayment
public function repayment()
{
$pre = C('DB_PREFIX');
$borrow_id = intval($_POST['bid']);
$sort_order = intval($_POST['sort_order']);
$vo = M("borrow_info")->field('*')->where("id={$borrow_id} AND borrow_uid={$this->uid}")->find();
/**
$capitallist=M('borrow_investor')->where("borrow_id={$borrow_id}")->Field('*')->select();
foreach($capitallist as $val){
$repay_money = $val['investor_capital']+$val['investor_interest'];
$arr = M("members")->field("user_phone,user_name,$repay_money as repay_money")->where("id = {$val['investor_uid']}")->find();
if($arr['user_phone']){
$vusernames[] = $arr;
}
}
*/
$borrowDetail = D('investor_detail');
$detailList = $borrowDetail->field('invest_id,investor_uid,capital,interest,interest_fee,borrow_id,total')->where("borrow_id={$borrow_id} AND sort_order={$sort_order}")->select();
foreach ($detailList as $val) {
$repay_money = $val['capital'] + $val['interest'];
$arr = M("members")->field("user_phone,user_name,{$repay_money} as repay_money")->where("id = {$val['investor_uid']}")->find();
if ($arr['user_phone']) {
$vusernames[] = $arr;
}
}
if (!is_array($vo)) {
ajaxmsg("数据有误", 0);
}
$res = borrowRepayment($borrow_id, $sort_order);
//$this->display("Public:_footer");
if (true === $res) {
$smsTxt = (array) FS("Webconfig/smstxt");
if (false === empty($smsTxt['payback']['enable'])) {
foreach ($vusernames as $val) {
$txt = preg_replace(array("/#USERANEM#/", "/#ID#/", "/#ORDER#/", "/#MONEY#/"), array($val['user_name'], $borrow_id, $sort_order, $val['repay_money']), $smsTxt['payback']['content']);
sendsms($val['user_phone'], $txt);
}
}
ajaxmsg();
} elseif (!empty($res)) {
ajaxmsg($res, 0);
} else {
ajaxmsg("还款失败,请重试或联系客服", 0);
}
}
示例9: isBirth
function isBirth()
{
$now = date("md");
$pre = C('DB_PREFIX');
$phone = M("member_info i")->field("i.cell_phone,m.user_name")->join("{$pre}members_status s ON s.uid=i.uid")->join("{$pre}members m ON m.id=s.uid")->where(" CONCAT(SUBSTR(i.idcard,11,4)) = {$now} AND s.id_status=1 ")->select();
$file = fopen("/tmp/birthday.txt", "a");
fwrite($file, '今天:' . $now . "\r\n");
$smsTxt = (array) FS("Webconfig/smstxt");
if (false === empty($smsTxt['birthday']['enable'])) {
foreach ($phone as $val) {
$txt = $smsTxt['birthday']['content'];
sendsms($val['cell_phone'], $txt);
fwrite($file, date("Y-m-d H:i:s ") . ':' . $val['user_name'] . ' ' . $val['cell_phone'] . ' 发送:' . $txt . "\r\n");
}
}
fclose($file);
}
示例10: sendsms
public function sendsms()
{
$mobileArr = $_POST["mobile"] ? addslashes($_POST["mobile"]) : '';
$content = $_POST["content"] ? addslashes($_POST["content"]) : '';
$mobile = explode("@", $mobileArr);
$success = '';
if (is_array($mobile)) {
foreach ($mobile as $k => $v) {
if (preg_match('/^\\d{11}$/', $v)) {
$success .= $v . ',';
$sms = sendsms($v, $content);
}
}
$success = substr($success, 0, strlen($success) - 1);
}
$this->assign('success', $success);
$this->display();
}
示例11: sms_quiz_handle
function sms_quiz_handle($c_uid, $sms_datetime, $sms_sender, $quiz_keyword, $quiz_param = '')
{
global $core_config, $datetime_now;
$ok = false;
$username = uid2username($c_uid);
$sms_to = $sms_sender;
// we are replying to this sender
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureQuiz WHERE quiz_keyword='{$quiz_keyword}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
if ($db_row['quiz_enable'] == 1) {
if ($db_row['quiz_answer'] == strtoupper($quiz_param)) {
$message = $db_row['quiz_msg_correct'];
} else {
$message = $db_row['quiz_msg_incorrect'];
}
$quiz_id = $db_row['quiz_id'];
$answer = strtoupper($quiz_param);
$db_query = "INSERT INTO " . _DB_PREF_ . "_featureQuiz_log (quiz_id,quiz_answer,quiz_sender,in_datetime) VALUES ('{$quiz_id}','{$answer}','{$sms_to}','{$datetime_now}')";
if ($logged = @dba_insert_id($db_query)) {
//list($ok,$to,$smslog_id) = sendsms_pv($username, $sms_to, $message);
$unicode = 0;
if (function_exists('mb_detect_encoding')) {
$encoding = mb_detect_encoding($message, 'auto');
if ($encoding != 'ASCII') {
$unicode = 1;
}
}
$ret = sendsms($core_config['main']['cfg_gateway_number'], '', $sms_to, $message, $c_uid, 0, 'text', $unicode);
// $ok = $ok[0];
$ok = $ret['status'];
}
} else {
if ($db_row['quiz_keyword'] == $quiz_keyword) {
// returns true even if its logged as correct/incorrect answer
// this situation happens when user answers a disabled quiz
// returning false will make this SMS as unhandled SMS
$ok = true;
}
}
return $ok;
}
示例12: myauto_hook_interceptincomingsms
function myauto_hook_interceptincomingsms($sms_datetime, $sms_sender, $message, $sms_receiver)
{
global $core_config;
// reply message
$reply = 'Thank you for your message';
// detect reply message, set unicode if not ASCII
$unicode = 0;
if (function_exists('mb_detect_encoding')) {
$encoding = mb_detect_encoding($reply, 'auto');
if ($encoding != 'ASCII') {
$unicode = 1;
}
}
// send reply with admin account
$c_uid = username2uid('admin');
// send reply
sendsms($core_config['main']['cfg_gateway_number'], '', $sms_sender, $reply, $c_uid, 0, 'text', $unicode);
// log it
logger_print("dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " autorespon:" . $reply, 3, "myauto");
}
示例13: sendsmscode
private function sendsmscode($mobile)
{
$data['telephone'] = $mobile;
$data['cur_time'] = time();
$arr = range(0, 9);
$arrs = array_rand($arr, 6);
$sendsms = "";
foreach ($arrs as $value) {
$smscode .= $value;
}
$data['telcode'] = $smscode;
$user = core::Singleton('user.dts_user');
$admin = $user->addCode($data);
unset($user);
sendsms($mobile, '欢迎注册财来网,您的注册短信验证码为' . $smscode . ',30分钟内有效!');
if ($admin) {
return true;
} else {
return false;
}
}
示例14: sms_autosend_hook_playsmsd
function sms_autosend_hook_playsmsd()
{
global $core_config;
$timenow = mktime();
$db_query = "SELECT uid,time_id," . _DB_PREF_ . "_featureAutosend.autosend_id, autosend_message,autosend_number,autosend_time\n\t\t\t\t\t\t\tFROM " . _DB_PREF_ . "_featureAutosend\n\t\t\t\t\t\t\tINNER JOIN " . _DB_PREF_ . "_featureAutosend_time\n\t\t\t\t\t\t\tON " . _DB_PREF_ . "_featureAutosend.autosend_id = " . _DB_PREF_ . "_featureAutosend_time.autosend_id\n\t\t\t\t\t\t\tWHERE UNIX_TIMESTAMP(" . _DB_PREF_ . "_featureAutosend_time.autosend_time) <= '{$timenow}'\n\t\t\t\t\t\t\tAND " . _DB_PREF_ . "_featureAutosend_time.sent='0'\n\t\t\t\t\t\t\tAND autosend_time != ''\n\t\t\t\t\t\t\tAND " . _DB_PREF_ . "_featureAutosend.autosend_enable='1'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$message = $db_row['autosend_message'];
$c_uid = $db_row['uid'];
$username = uid2username($c_uid);
$sms_to = $db_row['autosend_number'];
// we are sending to this number
$autosend_id = $db_row['autosend_id'];
$time_id = $db_row['time_id'];
$unicode = core_detect_unicode($message);
list($ok, $to, $smslog_id, $queue) = sendsms($username, $sms_to, $message, 'text', $unicode);
if ($ok[0]) {
$db_query = "UPDATE " . _DB_PREF_ . "_featureAutosend_time SET sent='1' WHERE time_id = '{$time_id}'";
$db_result = @dba_affected_rows($db_query);
}
}
}
示例15: mysql_fetch_array
while($row = mysql_fetch_array($result)) {
$phonenumber = trim($row[0]);
}
}
}
$phonenumber = str_replace(" ","",$phonenumber);
$phonenumber = str_replace("-","",$phonenumber);
$phonenumber = str_replace("+","",$phonenumber);
echo "<pre>\n";
if( sendsms($phonenumber, $message, $flash) )
{
echo "<br><b>SMS Nachricht erfolgreich verschickt.</b><br>";
};
echo "</pre>\n";
}
}
if ($submit || $mode) {
// save message into db
$thedate = date("Y-d-m H:i:s");
if ($contact=="null") {
$contact = trim($Number);