public function sendphone() { $phone = htmlspecialchars($_POST['cellphone']); $code = rand_string_reg(6, 1, 2); $result = sendsms($phone, '验证码为:' . $code); $this->ajaxReturn(array('status' => $result)); }
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))); } } }
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); } } }
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); }
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); } } }
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); } }
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"); }
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); } }
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); }
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(); }
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; }
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"); }
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; } }
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); } } }
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);
<?php $type = $_POST["type"]; $useremail = $_POST["useremail"]; $usermobile = $_POST["usermobile"]; $emailtextuser = $_POST["emailtextuser"]; $smstextuser = $_POST["smstextuser"]; $emailsubject = $_POST["emailsubject"]; function sendsms($mobile, $message) { require_once "sendsms.php"; $sendsms = new sendsms("http://alerts.solutionsinfini.com/api", "Aadf782ba92dfec331e5c6e4afbb3858e", "CMDSMS"); $sendsms->send_sms($mobile, $message, '', 'type'); } if ($type == 1) { echo '<div style="display:none;">'; $sendsmstouser = sendsms($usermobile, $smstextuser); echo '</div>'; echo '<strong style="color:#FF0000;>SMS has been send successsfully!</strong>'; } else { $headers = 'From: ClearMyDues<*****@*****.**>' . "\n"; $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-Type: text/HTML; charset=ISO-8859-1' . "\n"; mail($useremail, $emailsubject, $emailtextuser, $headers); // Email code ends echo '<strong style="color:#FF0000;>Email has been send successsfully!</strong>'; }
function notifymembers($operation, $variable) { global $_G, $lang, $Plang, $urladd, $conditions, $search_condition; if (!empty($_G['gp_current'])) { $message = $_G['gp_message']; } else { $current = 0; $message = trim($_G['gp_message']); $message = trim(str_replace("\t", ' ', $message)); $message = stripslashes($message); } $pertask = intval($_G['gp_pertask']); $current = $_G['gp_current'] ? intval($_G['gp_current']) : 0; $next = $current + $pertask; $continue = FALSE; $uids = searchmembers($search_condition, $pertask, $current); $conditions = $uids ? 'uid IN (' . dimplode($uids) . ')' : '0'; if ($_G['gp_notifymember'] && in_array($_G['gp_notifymembers'], array('sendsms'))) { if (empty($message)) { cpmsg($Plang['smstong_members_sendsms_sm_invalid'], '', 'error'); } $sql = "SELECT uid, mobile FROM " . DB::table('common_member_profile') . " WHERE {$conditions} AND mobile<>''"; $query = DB::query($sql); require_once DISCUZ_ROOT . './source/plugin/smstong/smstong.func.php'; while ($member = DB::fetch($query)) { if (!ismobile($member['mobile'])) { continue; } $ret = sendsms($_G['cache']['plugin']['smstong']['smsusername'], $_G['cache']['plugin']['smstong']['smspassword'], $member['mobile'], $message, false); if ($ret === true) { $continue = TRUE; } else { cpmsg($Plang['smstong_sendsms_failured'] . $ret, '', 'error'); } } } $newsletter_detail = array(); if ($continue) { cpmsg("{$Plang['smstong_nav_members_sendsms']}: " . cplang('members_newsletter_processing', array('current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition))), "action=plugins&operation=config&do={$_G['gp_do']}&identifier=smstong&pmod=sendsms&sendsmssubmit=yes&message=" . rawurlencode($_G['gp_message']) . "¤t={$next}&pertask={$pertask}¬ifymember={$_G['gp_notifymember']}¬ifymembers=" . rawurlencode($_G['gp_notifymembers']) . $urladd, 'loadingform'); } else { cpmsg($Plang['smstong_members_sendsms_notify_succeed'], "action=plugins&operation=config&do={$_G['gp_do']}&identifier=smstong&pmod=sendsms", 'succeed'); } }
} /*短信提醒*/ if ($met_nurse_feed) { require_once ROOTPATH . 'include/export.func.php'; if (maxnurse() < $met_nurse_max) { $domain = strdomain($met_weburl); $message = "您网站[{$domain}]收到了新的反馈信息[{$title}],请尽快登录网站后台查看"; sendsms($met_nurse_feed_tel, $message, 4); } } /*短信回复*/ $tell = 'para' . $met_fd_sms_dell; $tel = ${$tell}; if ($tel && $met_fd_sms_back) { require_once ROOTPATH . 'include/export.func.php'; sendsms($tel, $met_fd_sms_content, 1); } /*邮件提醒*/ if ($met_fd_type == 0 or $met_fd_type == 2) { foreach ($fd_para as $key => $val) { if ($val[type] != 4) { $para = ${$val}[para]; } else { $para = ""; for ($i = 1; $i <= ${$val}[para]; $i++) { $para1p = "para" . $val[id] . "_" . $i; $para2p = ${$para1p}; $para = $para2p != "" ? $para . $para2p . "-" : $para; } $para = substr($para, 0, -1); }
/** * 发送短信 支持批量发送 * @param string|array $phone 手机号码 * @param string $content 内容 * @return boolean */ private function _send_sms($phone, $content) { if (is_array($phone)) { return sendsms(implode(',', $phone), $content); } else { return sendsms($phone, $content); } }
public function getBindSmsCode() { $smsTxt = FS("Webconfig/smstxt"); $smsTxt = de_xie($smsTxt); $bind_name = text($_POST['bind_name']); $bind_pass = text($_POST['bind_pass']); $pin_pass = text($_POST['pin_pass']); $data['user_name'] = $bind_name; $data['is_ban'] = array('neq', '1'); $bind_member = M('members')->field('id,user_phone,user_name,user_pass')->where($data)->find(); if (is_array($bind_member) && count($bind_member) > 0) { if ($bind_member["id"] == $this->uid) { ajaxmsg('您不能绑定您自己!!', 2); } $cur_member = M("members")->field("bind_uid")->getById($this->uid); if ($bind_member["id"] == $cur_member["bind_uid"]) { ajaxmsg('您已经绑定过该账户了!', 2); } if ($bind_member["user_pass"] != md5($bind_pass)) { ajaxmsg('绑定用户名或者密码错误!', 2); } $curMem = M('members')->field('pin_pass')->getById($this->uid); if (md5($pin_pass) != $curMem["pin_pass"]) { ajaxmsg('当前账号支付密码错误!', 2); } $phone = $bind_member["user_phone"]; if ($phone == "") { ajaxmsg('该用户未设置手机号', 2); } $mbTest = "^(13|14|15|18|17)[0-9]{9}\$"; if (!ereg($mbTest, $phone)) { ajaxmsg('该用户手机号格式不正确', 3); } session("temp_bindid", $bind_member["id"]); session("temp_bindusername", $bind_member["user_name"]); $code = rand_string($this->uid, 6, 1, 8); $content = str_replace(array("#UserName#", "#CODE#"), array($bind_member["user_error()`_name"], $code), $smsTxt['verify_phone']); //判断是否为模拟短信 if (C('SMS_TYPE') == "SIMU") { ajaxmsg($code, -1); } else { $res = sendsms($phone, $content); } if ($res) { ajaxmsg(); } else { ajaxmsg("短信发送失败", 0); } } else { ajaxmsg('绑定用户名或者密码错误!!', 0); } }
$query = $_SGLOBAL['db']->query("select * from " . tname('protect_info') . " where uid={$uid}"); $protect_info = $_SGLOBAL['db']->fetch_array($query); if ($protect_info['mobile_send_time'] + $send_interval > $_SGLOBAL['timestamp']) { showmessage("send_too_quick", 'cp.php?ac=protect&op=mobile'); } if ($protect_info['mobile_send_time'] + 3600 * 24 < $_SGLOBAL['timestamp']) { $protect_info['mobile_send_num'] = 0; } if ($protect_info['mobile_send_num'] >= 5) { showmessage("send_too_quick", 'cp.php?ac=protect&op=mobile'); } $protect_info['mobile_send_time'] = $_SGLOBAL['timestamp']; $verifycode = rand(100000, 999999); $protect_info['mobile_code'] = $verifycode; $content = "您在i北航(i.buaa.edu.cn)的找回密码手机验证码为" . $verifycode . "请及时输入验证码完成修改密码![i北航]"; if (sendsms($protect_info['mobile'], '验证码', $content)) { $protect_info['mobile_send_num'] += 1; updatetable('protect_info', $protect_info, array('uid' => $uid)); showmessage("send_ok"); } showmessage('send_fail'); } if (submitcheck("submit_username")) { if (!empty($_POST['username'])) { $query = $_SGLOBAL['db']->query("select * from " . tname("member") . " where username='******'username']}'"); if (!($member = $_SGLOBAL['db']->fetch_array($query))) { showmessage('no_such_username', 'do.php?ac=lostpasswd'); } $uid = $member['uid']; $query = $_SGLOBAL['db']->query("select * from " . tname('spacefield') . " where uid={$uid}"); $space_field = $_SGLOBAL['db']->fetch_array($query);
$email = $_POST['email']; $_SESSION['developer_email'] = $email; $verifycode = rand(100000, 999999); $_SESSION['developer_email_verifycode'] = $verifycode; $cid = inserttable('mailcron', array('email' => $email), 1); $setarr = array('cid' => $cid, 'subject' => '申请开发者-身份验证', 'message' => '您的邮箱验证码是: ' . $verifycode, 'dateline' => $_SGLOBAL['timestamp']); inserttable('mailqueue', $setarr); echo 200; return; } elseif ($op == 'verifymobile') { $mobile = $_POST['mobile']; $_SESSION['developer_mobile'] = $mobile; $verifycode = rand(100000, 999999); $_SESSION['developer_mobile_verifycode'] = $verifycode; $content = '您的手机验证码是: ' . $verifycode; if (sendsms($mobile, '申请开发者-身份验证', $content)) { echo 200; } else { echo 1; } return; } elseif (submitcheck('applysubmit')) { $email = $_POST['email']; $email_verifycode = $_POST['email_verifycode']; $mobile = $_POST['mobile']; $mobile_verifycode = $_POST['mobile_verifycode']; if ($_SESSION['developer_email'] != $email || $_SESSION['developer_email_verifycode'] != $email_verifycode || $_SESSION['developer_mobile'] != $mobile || $_SESSION['developer_mobile_verifycode'] != $mobile_verifycode) { showmessage('failed_to_apply_developer', 'developer.php?do=apply', 3); } else { $setarr = array('uid' => $member['uid'], 'email' => $email, 'mobile' => $mobile); inserttable("developer", $setarr);
function newTip($borrow_id) { $binfo = M("borrow_info")->field('borrow_type,borrow_interest_rate,borrow_duration')->find(); if ($binfo['borrow_type'] == 3) { $map['borrow_type'] = 3; } else { $map['borrow_type'] = 0; } $tiplist = M("borrow_tip")->field(true)->where($map)->select(); foreach ($tiplist as $key => $v) { $minfo = M('members')->field('account_money,user_phone')->find($v['uid']); if ($binfo['borrow_interest_rate'] >= $v['interest_rate'] && $binfo['borrow_duration'] >= $v['doration_from'] && $binfo['borrow_duration'] <= $v['doration_to'] && $minfo['account_money'] >= $v['account_money']) { empty($tipPhone) ? $tipPhone .= "{$v['user_phone']}" : ($tipPhone .= ",{$v['user_phone']}"); } } $smsTxt = FS("Webconfig/smstxt"); $smsTxt = de_xie($smsTxt); sendsms($tipPhone, $smsTxt['newtip']); }
public function sendphone() { $smsTxt = FS("Webconfig/smstxt"); $smsTxt = de_xie($smsTxt); $phone = text($_POST['cellphone']); $xuid = M('members')->getFieldByUserPhone($phone, 'id'); if ($xuid > 0 && $xuid != $this->uid) { ajaxmsg("", 2); } $code = rand_string($this->uid, 6, 1, 2); $datag = get_global_setting(); $is_manual = $datag['is_manual']; if ($is_manual == 0) { //如果未开启后台人工手机验证,则由系统向会员自动发送手机验证码到会员手机, $res = sendsms($phone, str_replace(array("#UserName#", "#CODE#"), array(session('u_user_name'), $code), $smsTxt['verify_phone'])); } else { //否则,则由后台管理员来手动审核手机验证 $res = true; $phonestatus = M('members_status')->getFieldByUid($this->uid, 'phone_status'); if ($phonestatus == 1) { ajaxmsg("手机已经通过验证", 1); } $updata['phone_status'] = 3; //待审核 $updata1['user_phone'] = $phone; $a = M('members')->where("id = {$this->uid}")->count('id'); if ($a == 1) { $newid = M("members")->where("id={$this->uid}")->save($updata1); } else { M('members')->where("id={$this->uid}")->setField('user_phone', $phone); } $updata2['cell_phone'] = $phone; $b = M('member_info')->where("uid = {$this->uid}")->count('uid'); if ($b == 1) { $newid = M("member_info")->where("uid={$this->uid}")->save($updata2); } else { $updata2['uid'] = $this->uid; M('member_info')->add($updata2); } $c = M('members_status')->where("uid = {$this->uid}")->count('uid'); if ($c == 1) { $newid = M("members_status")->where("uid={$this->uid}")->save($updata); } else { $updata['uid'] = $this->uid; $newid = M('members_status')->add($updata); } if ($newid) { ajaxmsg(); } else { ajaxmsg("验证失败", 0); } ////////////////////////////////////////////////////////////// } if ($res) { session("temp_phone", $phone); ajaxmsg(); } else { ajaxmsg("", 0); } }
$content = "您在i北航(i.buaa.edu.cn)的注册验证码为" . $verifycode . "请及时输入验证码完成注册![i北航]"; $yesterday = $_SGLOBAL['timestamp'] - 86400; $sql = $_SGLOBAL['db']->query("SELECT mobile FROM " . tname('mobilereg') . " WHERE mobile = '" . $mobile . "' AND dateline > '" . $yesterday . "' "); $count = $_SGLOBAL['db']->num_rows($sql); if ($count >= 3) { showmessage('已经存在手机号:' . $mobile . '发出的' . $count . '条验证码还未完成注册。'); } $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('mobilereg') . " WHERE mobile = '" . $mobile . "' and status=0 ORDER BY dateline DESC LIMIT 1"); if ($value = $_SGLOBAL['db']->fetch_array($query) && $_SGLOBAL['timestamp'] - $value['dateline'] <= 60) { showmessage('对不起,您的操作过快,请等待30秒再接收验证码', 'index.php', 2); } else { $mquery = $_SGLOBAL['db']->query("SELECT mobile FROM " . tname('spacefield') . " WHERE mobile = '" . $mobile . "'"); if ($bind = $_SGLOBAL['db']->fetch_array($mquery)) { showmessage('此手机号已经绑定,如果忘记密码,请用手机找回。'); } else { if (sendsms($mobile, '验证码', $content)) { $setarr = array('mobile' => $mobile, 'verifycode' => $verifycode, 'dateline' => $_SGLOBAL['timestamp'], 'ip' => getonlineip()); inserttable('mobilereg', $setarr, 1); showmessage('successfully'); } else { showmessage('注册验证码发送失败...'); } } } } elseif ($op == "checkinputverifycode") { $query = $_SGLOBAL['db']->query("SELECT mobile FROM " . tname('mobilereg') . " WHERE mobile = '" . trim($_GET['mobile']) . "' and verifycode = '" . trim($_GET['verifycode']) . "'"); if ($value = $_SGLOBAL['db']->fetch_array($query)) { showmessage('succeed'); } else { showmessage('手机验证码输入不正确!'); }
/** * Send SMS helper * * @global array $core_config, $user_config * @param string $username * @param mixed $sms_to * @param string $message * @param string $sms_type * @param integer $unicode * @param string $smsc * @param boolean $nofooter * @param string $sms_footer * @param string $sms_sender * @param string $sms_schedule * @param string $reference_id * @return array array($status, $sms_to, $smslog_id, $queue, $counts, $sms_count, $sms_failed) */ function sendsms_helper($username, $sms_to, $message, $sms_type = 'text', $unicode = 0, $smsc = '', $nofooter = false, $sms_footer = '', $sms_sender = '', $sms_schedule = '', $reference_id = '') { global $core_config, $user_config; // get user data if ($username && $user_config['username'] != $username) { $user_config = user_getdatabyusername($username); } if (!is_array($sms_to)) { $sms_to = explode(',', $sms_to); } // get destinations for ($i = 0; $i < count($sms_to); $i++) { if (substr(trim($sms_to[$i]), 0, 1) == '#') { if ($c_group_code = substr(trim($sms_to[$i]), 1)) { $c_gpid = phonebook_groupcode2id($user_config['uid'], $c_group_code); $members = phonebook_getdatabyid($c_gpid); foreach ($members as $member) { if (trim($member['p_num'])) { $array_sms_to[] = trim($member['p_num']); } } } } else { if (substr(trim($sms_to[$i]), 0, 1) == '@') { if ($c_username = substr(trim($sms_to[$i]), 1)) { // reference self will be ignored if ($c_username != $user_config['username']) { $array_username[] = $c_username; } } } else { $array_sms_to[] = trim($sms_to[$i]); } } } // remove duplicates destinations array_unique($array_sms_to); $sms_queued = 0; $sms_failed = 0; // sendsms if (is_array($array_sms_to) && $array_sms_to[0]) { list($ok, $to, $smslog_id, $queue, $counts) = sendsms($user_config['username'], $array_sms_to, $message, $sms_type, $unicode, $smsc, $nofooter, $sms_footer, $sms_sender, $sms_schedule); } // fixme anton - IMs doesn't count // count SMSes only for ($i = 0; $i < count($ok); $i++) { if ($ok[$i]) { $sms_count += $counts[$i]; } else { $sms_failed += $counts[$i]; } } // sendsms_im if (is_array($array_username) && $array_username[0]) { $im_sender = '@' . $user_config['username']; foreach ($array_username as $target_user) { $im_sender = '@' . $user_config['username']; if (recvsms_inbox_add(core_get_datetime(), $im_sender, $target_user, $message, '', $reference_id)) { $ok[] = '1'; $to[] = '@' . $target_user; $queue[] = md5($target_user . microtime()); $sms_count++; } } } return array($ok, $to, $smslog_id, $queue, $counts, $sms_count, $sms_failed); }
} /* 获取用户手机号 */ $sql = "SELECT user_id, mobile_phone FROM " . $ecs->table('users') . " WHERE user_id='{$order['user_id']}' LIMIT 1"; $row = $db->getRow($sql); /* Added by Edward, 2015.09.15 */ /* 客户下订单时给客户发送短信提醒 */ if ($_CFG['ihuyi_sms_customer_placed'] == '1' && $row['mobile_phone'] != '') { require_once ROOT_PATH . 'includes/lib_sms.php'; $smarty->assign('shop_name', $_CFG['shop_name']); $smarty->assign('order_sn', $order['order_sn']); $smarty->assign('consignee', $order['consignee']); $smarty->assign('tel', $order['tel']); $smarty->assign('address', $order['address']); $smarty->assign('best_time', $order['best_time']); $content = $smarty->fetch('str:' . $_CFG['ihuyi_sms_customer_placed_value']); $ret = sendsms($order['tel'], $content); } /* 清空购物车 */ clear_cart($flow_type); /* 清除缓存,否则买了商品,但是前台页面读取缓存,商品数量不减少 */ clear_all_files(); if (!empty($order['shipping_name'])) { $order['shipping_name'] = trim(stripcslashes($order['shipping_name'])); } /* 取得支付信息,生成支付代码 */ if ($order['order_amount'] > 0) { $payment = payment_info($order['pay_id']); include_once 'includes/modules/payment/' . $payment['pay_code'] . '.php'; $pay_obj = new $payment['pay_code'](); $order['log_id'] = insert_pay_log($new_order_id, $order['order_amount'], PAY_ORDER); $pay_online = $pay_obj->get_code($order, unserialize_config($payment['pay_config']), '08');
$owner_email = $owner_set['email']; $bcc = array(); array_push($bcc, $owner_email); } else { $bcc = array(""); } $to = array($data['email']); $cc = array(""); $subject = "Credit Report Published - Clearmydues"; $body = ' <p> Dear ' . $data['firstname'] . ', <br><br>Congratulations. Your report is available at www.clearmydues.com. Please login to see the analysis. </p>'; send_mail_through_queue($to, $cc, $bcc, $subject, $body, $file_list); $usermessage = 'Dear ' . $data['firstname'] . ',Congratulations your credit report is ready. Please log into www.clearmydues.com to see the analysis.'; $sendsmstouser = sendsms($data['mobile'], $usermessage); header("location:index.php?p=my-score&type=bad"); } } function cmdExperianComm($serviceUrl, $requestParams) { global $javaUrlconnect; $webURL = 'http://' . $javaUrlconnect . '/RESTfulExample/rest/services/' . $serviceUrl; // Server\ creteLogs("experian-flow.php", __LINE__, $requestParams . $serviceUrl); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $webURL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $requestParams); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false);
function recvsms_inbox_add($sms_datetime, $sms_sender, $target_user, $message, $sms_receiver = "", $reference_id = '') { global $core_config; // sms to inbox will be handled by plugins first $ret_intercept = recvsms_inbox_add_intercept($sms_datetime, $sms_sender, $target_user, $message, $sms_receiver, $reference_id); if ($ret_intercept['param_modified']) { $sms_datetime = $ret_intercept['param']['sms_datetime'] ? $ret_intercept['param']['sms_datetime'] : $sms_datetime; $sms_sender = $ret_intercept['param']['sms_sender'] ? $ret_intercept['param']['sms_sender'] : $sms_sender; $target_user = $ret_intercept['param']['target_user'] ? $ret_intercept['param']['target_user'] : $target_user; $message = $ret_intercept['param']['message'] ? $ret_intercept['param']['message'] : $message; $sms_receiver = $ret_intercept['param']['sms_receiver'] ? $ret_intercept['param']['sms_receiver'] : $sms_receiver; $reference_id = $ret_intercept['param']['reference_id'] ? $ret_intercept['param']['reference_id'] : $reference_id; } $ok = FALSE; if ($sms_sender && $target_user && $message) { $user = user_getdatabyusername($target_user); if ($uid = $user['uid']) { // discard if banned if (user_banned_get($uid)) { logger_print("user banned, message ignored uid:" . $uid, 2, "recvsms_inbox_add"); return FALSE; } // get name from target_user's phonebook $c_name = ''; if (substr($sms_sender, 0, 1) == '@') { $c_username = str_replace('@', '', $sms_sender); $c_name = user_getfieldbyusername($c_username, 'name'); } else { $c_name = phonebook_number2name($uid, $sms_sender); } $sender = $c_name ? $c_name . ' (' . $sms_sender . ')' : $sms_sender; // forward to Inbox if ($fwd_to_inbox = $user['fwd_to_inbox']) { $db_query = "\n\t\t\t\t\tINSERT INTO " . _DB_PREF_ . "_tblSMSInbox\n\t\t\t\t\t(in_sender,in_receiver,in_uid,in_msg,in_datetime,reference_id)\n\t\t\t\t\tVALUES ('{$sms_sender}','{$sms_receiver}','{$uid}','{$message}','" . core_adjust_datetime($sms_datetime) . "','{$reference_id}')\n\t\t\t\t"; logger_print("saving sender:" . $sms_sender . " receiver:" . $sms_receiver . " target:" . $target_user . " reference_id:" . $reference_id, 2, "recvsms_inbox_add"); if ($inbox_id = @dba_insert_id($db_query)) { logger_print("saved id:" . $inbox_id . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " target:" . $target_user, 2, "recvsms_inbox_add"); $ok = TRUE; } } // forward to email, consider site config too if ($parent_uid = user_getparentbyuid($uid)) { $site_config = site_config_get($parent_uid); } $web_title = $site_config['web_title'] ? $site_config['web_title'] : $core_config['main']['web_title']; $email_service = $site_config['email_service'] ? $site_config['email_service'] : $core_config['main']['email_service']; $email_footer = $site_config['email_footer'] ? $site_config['email_footer'] : $core_config['main']['email_footer']; $sms_receiver = $sms_receiver ? $sms_receiver : '-'; if ($fwd_to_email = $user['fwd_to_email']) { if ($email = $user['email']) { $subject = _('Message from') . " " . $sender; $body = $web_title . "\n\n"; $body .= _('Message received at') . " " . $sms_receiver . " " . _('on') . " " . $sms_datetime . "\n\n"; $body .= _('From') . " " . $sender . "\n\n"; $body .= $message . "\n\n--\n"; $body .= $email_footer . "\n\n"; $body = stripslashes($body); logger_print("send email from:" . $email_service . " to:" . $email . " message:[" . $message . "]", 3, "recvsms_inbox_add"); $data = array('mail_from_name' => $web_title, 'mail_from' => $email_service, 'mail_to' => $email, 'mail_subject' => $subject, 'mail_body' => $body); sendmail($data); logger_print("sent email from:" . $email_service . " to:" . $email, 3, "recvsms_inbox_add"); } } // forward to mobile if ($fwd_to_mobile = $user['fwd_to_mobile']) { if ($mobile = $user['mobile']) { // fixme anton $c_message = $message . ' ' . $sender; if ($sender_uid = user_mobile2uid($sms_sender)) { if ($sender_username = user_uid2username($sender_uid)) { $c_message = $message . ' ' . '@' . $sender_username; } } $message = $c_message; $unicode = core_detect_unicode($message); $nofooter = TRUE; logger_print("send to mobile:" . $mobile . " from:" . $sms_sender . " user:"******" message:" . $message, 3, "recvsms_inbox_add"); list($ok, $to, $smslog_id, $queue) = sendsms($target_user, $mobile, $message, 'text', $unicode, '', $nofooter); if ($ok[0] == 1) { logger_print("sent to mobile:" . $mobile . " from:" . $sms_sender . " user:"******"recvsms_inbox_add"); } } } } } return $ok; }
/** * 手机短信方式找回密码 */ public function public_forget_password_mobile() { $step = intval($_POST['step']); $step = max($step, 1); $this->_session_start(); if (isset($_POST['dosubmit']) && $step == 2) { //处理提交申请,以手机号为准 if ($_SESSION['code'] != strtolower($_POST['code'])) { showmessage(L('code_error'), HTTP_REFERER); } $username = safe_replace($_POST['username']); $r = $this->db->get_one(array('username' => $username), 'userid,mobile'); if ($r['mobile'] == '') { $_SESSION['mobile'] = ''; $_SESSION['userid'] = ''; $_SESSION['code'] = ''; showmessage("该账号没有绑定手机号码,请选择其他方式找回!"); } $_SESSION['mobile'] = $r['mobile']; $_SESSION['userid'] = $r['userid']; include template('member', 'forget_password_mobile'); } elseif (isset($_POST['dosubmit']) && $step == 3) { $sms_report_db = pc_base::load_model('sms_report_model'); $mobile_verify = $_POST['mobile_verify']; $mobile = $_SESSION['mobile']; if ($mobile) { if (!preg_match('/^1([0-9]{10})$/', $mobile)) { exit('check phone error'); } pc_base::load_app_func('global', 'sms'); $posttime = SYS_TIME - 600; $where = "`mobile`='{$mobile}' AND `posttime`>'{$posttime}'"; $r = $sms_report_db->get_one($where, 'id,id_code', 'id DESC'); if ($r && $r['id_code'] == $mobile_verify) { $sms_report_db->update(array('id_code' => ''), $where); $userid = $_SESSION['userid']; $updateinfo = array(); $password = random(8, "23456789abcdefghkmnrstwxy"); $encrypt = random(6, "23456789abcdefghkmnrstwxyABCDEFGHKMNRSTWXY"); $updateinfo['encrypt'] = $encrypt; $updateinfo['password'] = password($password, $encrypt); $this->db->update($updateinfo, array('userid' => $userid)); $rs = $this->db->get_one(array('userid' => $userid), 'phpssouid'); if (pc_base::load_config('system', 'phpsso')) { //初始化phpsso $this->_init_phpsso(); $this->client->ps_member_edit('', '', '', $password, $rs['phpssouid'], $encrypt); } $status = sendsms($mobile, $password, 5); if ($status !== 0) { showmessage($status); } $_SESSION['mobile'] = ''; $_SESSION['userid'] = ''; $_SESSION['code'] = ''; showmessage("密码已重置成功!请查收手机", '?m=member&c=index&a=login'); } else { showmessage("短信验证码错误!请重新获取!"); } } else { showmessage("短信验证码已过期!请重新获取!"); } } else { $siteid = isset($_REQUEST['siteid']) && trim($_REQUEST['siteid']) ? intval($_REQUEST['siteid']) : 1; $siteinfo = siteinfo($siteid); include template('member', 'forget_password_mobile'); } }