public function index()
 {
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     if (app_conf("SMS_ON") == 0) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['SMS_OFF'];
         //短信未开启
         output($root);
     }
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     $root['user_id'] = $user_id;
     if ($user_id > 0) {
         $mobile = $user['mobile'];
         $code = intval($user['bind_verify']);
         if ($mobile == '') {
             $root['response_code'] = 0;
             $root['show_err'] = $GLOBALS['lang']['MOBILE_EMPTY_TIP'];
             output($root);
         }
         if (!check_mobile($mobile)) {
             $root['response_code'] = 0;
             $root['show_err'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
             output($root);
         }
         if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
             $root['response_code'] = 0;
             $root['show_err'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
             //短信发送太快
             output($root);
         }
         //开始生成手机验证
         if ($code == 0) {
             //已经生成过了,则使用旧的验证码;反之生成一个新的
             $code = rand(1111, 9999);
             $GLOBALS['db']->query("update " . DB_PREFIX . "user set bind_verify = '" . $code . "',verify_create_time = '" . TIME_UTC . "' where id = " . $user_id);
         }
         //使用立即发送方式
         $result = send_verify_sms($mobile, $code, $user, true);
         //
         $root['response_code'] = $result['status'];
         if ($root['response_code'] == 1) {
             $root['show_err'] = $GLOBALS['lang']['MOBILE_VERIFY_SEND_OK'];
         } else {
             $root['show_err'] = $result['msg'];
             if ($root['show_err'] == null || $root['show_err'] == '') {
                 $root['show_err'] = "验证码发送失败";
             }
         }
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
 public function index()
 {
     $mobile = addslashes(htmlspecialchars(trim($GLOBALS['request']['mobile'])));
     $root = array();
     if (app_conf("SMS_ON") == 0) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['SMS_OFF'];
         //短信未开启
         output($root);
     }
     if ($mobile == '') {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['MOBILE_EMPTY_TIP'];
         //请输入你的手机号
         output($root);
     }
     if (!check_mobile($mobile)) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
         //请填写正确的手机号码
         output($root);
     }
     if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where mobile = '" . $mobile . "'") > 0) {
         $field_show_name = $GLOBALS['lang']['USER_TITLE_mobile'];
         //手机号码
         $root['response_code'] = 0;
         $root['show_err'] = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $field_show_name);
         //已存在,请重新输入
         output($root);
     }
     if (!check_ipop_limit(CLIENT_IP, "mobile_verify", 60, 0)) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
         //短信发送太快
         output($root);
     }
     //删除超过5分钟的验证码
     $GLOBALS['db']->query("DELETE FROM " . DB_PREFIX . "mobile_verify_code WHERE create_time <=" . TIME_UTC - 300);
     $verify_code = $GLOBALS['db']->getOne("select verify_code from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and create_time>=" . (TIME_UTC - 180) . " ORDER BY id DESC");
     if (intval($verify_code) == 0) {
         //如果数据库中存在验证码,则取数据库中的(上次的 );确保连接发送时,前后2条的验证码是一至的.==为了防止延时
         //开始生成手机验证
         $verify_code = rand(1111, 9999);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_verify_code", array("verify_code" => $verify_code, "mobile" => $mobile, "create_time" => TIME_UTC, "client_ip" => CLIENT_IP), "INSERT");
     }
     //使用立即发送方式
     $result = send_verify_sms($mobile, $verify_code, null, true);
     //
     $root['response_code'] = $result['status'];
     if ($root['response_code'] == 1) {
         $root['show_err'] = $GLOBALS['lang']['MOBILE_VERIFY_SEND_OK'];
     } else {
         $root['show_err'] = $result['msg'];
         if ($root['show_err'] == null || $root['show_err'] == '') {
             $root['show_err'] = "验证码发送失败";
         }
     }
     //../system/sms/FW_sms.php  提示账户或密码错误地址
     output($root);
 }
 public function index()
 {
     $mobile = addslashes(htmlspecialchars(trim($GLOBALS['request']['mobile'])));
     $root = array();
     if (app_conf("SMS_ON") == 0) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['SMS_OFF'];
         output($root);
     }
     if ($mobile == '') {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['MOBILE_EMPTY_TIP'];
         output($root);
     }
     if (!check_mobile($mobile)) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
         output($root);
     }
     if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
         output($root);
     }
     $sql = "select id,bind_verify from " . DB_PREFIX . "user where mobile = '" . $mobile . "' and is_delete = 0";
     $user_info = $GLOBALS['db']->getRow($sql);
     $user_id = intval($user_info['id']);
     $code = intval($user_info['bind_verify']);
     if ($user_id == 0) {
         //$field_show_name = $GLOBALS['lang']['USER_TITLE_mobile'];
         $root['response_code'] = 0;
         $root['show_err'] = '手机号码不存在或被禁用';
         output($root);
     }
     //开始生成手机验证
     if ($code == 0) {
         //已经生成过了,则使用旧的验证码;反之生成一个新的
         $code = rand(1111, 9999);
         $GLOBALS['db']->query("update " . DB_PREFIX . "user set bind_verify = '" . $code . "',verify_create_time = '" . TIME_UTC . "' where id = " . $user_id);
     }
     //使用立即发送方式
     $result = send_verify_sms($mobile, $code, null, true);
     //
     $root['response_code'] = $result['status'];
     if ($root['response_code'] == 1) {
         $root['show_err'] = $GLOBALS['lang']['MOBILE_VERIFY_SEND_OK'];
     } else {
         $root['show_err'] = $result['msg'];
         if ($root['show_err'] == null || $root['show_err'] == '') {
             $root['show_err'] = "验证码发送失败";
         }
     }
     $root['post_type'] = trim($GLOBALS['request']['post_type']);
     output($root);
 }
 public function index()
 {
     $mobile = addslashes(htmlspecialchars(trim($GLOBALS['request']['mobile'])));
     $root = array();
     if (app_conf("SMS_ON") == 0) {
         $root['response_code'] = 0;
         $root['show_err'] = '短信未开启';
         output($root);
     }
     if ($mobile == '') {
         $root['response_code'] = 0;
         $root['show_err'] = '请输入你的手机号';
         output($root);
     }
     if (!check_mobile($mobile)) {
         $root['response_code'] = 0;
         $root['show_err'] = '请填写正确的手机号码';
         output($root);
     }
     if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where mobile = '" . $mobile . "'") > 0) {
         $field_show_name = '手机号码';
         $root['response_code'] = 0;
         $root['show_err'] = sprintf('%s已存在,请重新输入', $field_show_name);
         output($root);
     }
     if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
         $root['response_code'] = 0;
         $root['show_err'] = '短信发送太快,请稍后再试';
         output($root);
     }
     //删除超过5分钟的验证码
     $GLOBALS['db']->query("DELETE FROM " . DB_PREFIX . "mobile_verify_code WHERE create_time <=" . get_gmtime() - 300);
     $verify_code = $GLOBALS['db']->getOne("select verify_code from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and create_time>=" . (TIME_UTC - 180) . " ORDER BY id DESC");
     if (intval($verify_code) == 0) {
         //如果数据库中存在验证码,则取数据库中的(上次的 );确保连接发送时,前后2条的验证码是一至的.==为了防止延时
         //开始生成手机验证
         $verify_code = rand(1111, 9999);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_verify_code", array("verify_code" => $verify_code, "mobile" => $mobile, "create_time" => get_gmtime(), "client_ip" => get_client_ip()), "INSERT");
     }
     //使用立即发送方式
     $result = send_verify_sms($mobile, $verify_code, null, true);
     //
     $root['response_code'] = $result['status'];
     if ($root['response_code'] == 1) {
         $root['show_err'] = '验证短信已经发送,请注意查收';
     } else {
         $root['show_err'] = $result['msg'];
         if ($root['show_err'] == null || $root['show_err'] == '') {
             $root['show_err'] = "验证码发送失败";
         }
     }
     output($root);
 }
示例#5
0
 /**
  * 发送手机验证码
  */
 public function send_sms_code()
 {
     $verify_code = strim($_REQUEST['verify_code']);
     $mobile_phone = strim($_REQUEST['mobile']);
     if ($mobile_phone == "") {
         $data['status'] = false;
         $data['info'] = "请输入手机号";
         $data['field'] = "user_mobile";
         ajax_return($data);
     }
     if (!check_mobile($mobile_phone)) {
         $data['status'] = false;
         $data['info'] = "手机号格式不正确";
         $data['field'] = "user_mobile";
         ajax_return($data);
     }
     if (intval($_REQUEST['unique']) == 1) {
         if (intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier_submit where account_mobile = '" . $mobile_phone . "'")) > 0) {
             $data['status'] = false;
             $data['info'] = "手机号已被注册";
             $data['field'] = "account_mobile";
             ajax_return($data);
         }
     }
     $sms_ipcount = load_sms_ipcount();
     if ($sms_ipcount > 1) {
         //需要图形验证码
         if (es_session::get("verify") != md5($verify_code)) {
             $data['status'] = false;
             $data['info'] = "验证码错误";
             $data['field'] = "verify_code";
             ajax_return($data);
         }
     }
     if (!check_ipop_limit(CLIENT_IP, "send_sms_code", SMS_TIMESPAN)) {
         showErr("请勿频繁发送短信", 1);
     }
     //删除失效验证码
     $sql = "DELETE FROM " . DB_PREFIX . "sms_mobile_verify WHERE add_time <=" . (NOW_TIME - SMS_EXPIRESPAN);
     $GLOBALS['db']->query($sql);
     $mobile_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "sms_mobile_verify where mobile_phone = '" . $mobile_phone . "'");
     if ($mobile_data) {
         //重新发送未失效的验证码
         $code = $mobile_data['code'];
         $mobile_data['add_time'] = NOW_TIME;
         $GLOBALS['db']->query("update " . DB_PREFIX . "sms_mobile_verify set add_time = '" . $mobile_data['add_time'] . "',send_count = send_count + 1 where mobile_phone = '" . $mobile_phone . "'");
     } else {
         $code = rand(100000, 999999);
         $mobile_data['mobile_phone'] = $mobile_phone;
         $mobile_data['add_time'] = NOW_TIME;
         $mobile_data['code'] = $code;
         $mobile_data['ip'] = CLIENT_IP;
         $GLOBALS['db']->autoExecute(DB_PREFIX . "sms_mobile_verify", $mobile_data, "INSERT", "", "SILENT");
     }
     send_verify_sms($mobile_phone, $code);
     es_session::delete("verify");
     //删除图形验证码
     $data['status'] = true;
     $data['info'] = "发送成功";
     $data['lesstime'] = SMS_TIMESPAN - (NOW_TIME - $mobile_data['add_time']);
     //剩余时间
     $data['sms_ipcount'] = load_sms_ipcount();
     ajax_return($data);
 }
示例#6
0
 public function send_mobie_pwd_sncode_new()
 {
     if (app_conf("SMS_ON") == 0) {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['SMS_OFF'];
         ajax_return($data);
     }
     $mobile = addslashes(htmlspecialchars(trim($_REQUEST['mobile'])));
     if ($mobile == '') {
         $data['status'] = 0;
         $data['info'] = "请输入你的手机号";
         ajax_return($data);
     }
     if (!check_mobile($mobile)) {
         $data['status'] = 0;
         $data['info'] = "请填写正确的手机号码";
         ajax_return($data);
     }
     $field_name = addslashes(trim($_REQUEST['mobile']));
     $field_data = $mobile;
     $user_id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where mobile='" . $field_data . "' ");
     if ($user_id) {
         if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
             $data['status'] = 0;
             $data['info'] = "发送速度太快了";
             ajax_return($data);
         }
         if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and client_ip='" . get_client_ip() . "' and create_time>=" . (get_gmtime() - 60) . " ORDER BY id DESC") > 0) {
             $data['status'] = 0;
             $data['info'] = "发送速度太快了";
             ajax_return($data);
         }
         //删除超过5分钟的验证码
         $GLOBALS['db']->query("DELETE FROM " . DB_PREFIX . "mobile_verify_code WHERE create_time <=" . get_gmtime() - 300);
         $verify_code = $GLOBALS['db']->getOne("select verify_code from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and create_time>=" . (NOW_TIME - 180) . " ORDER BY id DESC");
         if (intval($verify_code) == 0) {
             //如果数据库中存在验证码,则取数据库中的(上次的 );确保连接发送时,前后2条的验证码是一至的.==为了防止延时
             //开始生成手机验证
             $verify_code = rand(100000, 999999);
             $GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_verify_code", array("verify_code" => $verify_code, "mobile" => $mobile, "create_time" => get_gmtime(), "client_ip" => get_client_ip()), "INSERT");
         }
         //使用立即发送方式
         send_verify_sms($mobile, $verify_code);
         $data['status'] = 1;
         $data['info'] = "验证码发送成功";
         ajax_return($data);
     } else {
         $result['status'] = 0;
         $result['info'] = "该手机不存在,请重新输入";
         ajax_return($result);
     }
 }
示例#7
0
 public function send_mobile_verify_code()
 {
     if (app_conf("SMS_ON") == 0) {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['SMS_OFF'];
         ajax_return($data);
     }
     $mobile = addslashes(htmlspecialchars(trim($_REQUEST['mobile'])));
     if ($mobile == '') {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['MOBILE_EMPTY_TIP'];
         ajax_return($data);
     }
     if (!check_mobile($mobile)) {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
         ajax_return($data);
     }
     $field_name = addslashes(trim($_REQUEST['mobile']));
     $field_data = $mobile;
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $res = check_user($field_name, $field_data);
     $result = array("status" => 1, "info" => '');
     if (!$res['status']) {
         $error = $res['data'];
         if (!$error['field_show_name']) {
             $error['field_show_name'] = $GLOBALS['lang']['USER_TITLE_' . strtoupper($error['field_name'])];
         }
         if ($error['error'] == EMPTY_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['EMPTY_ERROR_TIP'], $error['field_show_name']);
         }
         if ($error['error'] == FORMAT_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['FORMAT_ERROR_TIP'], $error['field_show_name']);
         }
         if ($error['error'] == EXIST_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $error['field_show_name']);
         }
         $result['status'] = 0;
         $result['info'] = $error_msg;
         ajax_return($result);
     }
     if (!check_ipop_limit(CLIENT_IP, "mobile_verify", 60, 0)) {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
         ajax_return($data);
     }
     if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and client_ip='" . CLIENT_IP . "' and create_time>=" . (get_gmtime() - 60) . " ORDER BY id DESC") > 0) {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
         ajax_return($data);
     }
     /*
     //删除超过5分钟的验证码
     $GLOBALS['db']->query("DELETE FROM ".DB_PREFIX."mobile_verify_code WHERE create_time <=".get_gmtime()-300);
     //开始生成手机验证
     $code = rand(1111,9999);
     $GLOBALS['db']->autoExecute(DB_PREFIX."mobile_verify_code",array("verify_code"=>$code,"mobile"=>$mobile,"create_time"=>get_gmtime(),"client_ip"=>CLIENT_IP),"INSERT");
     send_verify_sms($mobile,$code);
     $data['status'] = 1;
     $data['info'] = "验证码发送成功";
     */
     //删除超过5分钟的验证码
     $GLOBALS['db']->query("DELETE FROM " . DB_PREFIX . "mobile_verify_code WHERE create_time <=" . get_gmtime() - 300);
     $verify_code = $GLOBALS['db']->getOne("select verify_code from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and create_time>=" . (TIME_UTC - 180) . " ORDER BY id DESC");
     if (intval($verify_code) == 0) {
         //如果数据库中存在验证码,则取数据库中的(上次的 );确保连接发送时,前后2条的验证码是一至的.==为了防止延时
         //开始生成手机验证
         $verify_code = rand(111111, 999999);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_verify_code", array("verify_code" => $verify_code, "mobile" => $mobile, "create_time" => get_gmtime(), "client_ip" => CLIENT_IP), "INSERT");
     }
     //使用立即发送方式
     $result = send_verify_sms($mobile, $verify_code, null, true);
     //
     $data['status'] = $result['status'];
     if ($data['status'] == 1) {
         $data['info'] = $GLOBALS['lang']['MOBILE_VERIFY_SEND_OK'];
     } else {
         $data['info'] = $result['msg'];
         if ($data['info'] == null || $data['info'] == '') {
             $data['info'] = "验证码发送失败";
         }
     }
     ajax_return($data);
 }
示例#8
0
 /**
  * 发送商家提现手机验证码
  */
 public function biz_sms_code()
 {
     $s_account_info = $GLOBALS["account_info"];
     $verify_code = strim($_REQUEST['verify_code']);
     $sms_ipcount = load_sms_ipcount();
     if ($sms_ipcount > 1) {
         //需要图形验证码
         if (es_session::get("verify") != md5($verify_code)) {
             $data['status'] = false;
             $data['info'] = "图形验证码错误";
             $data['field'] = "verify_code";
             ajax_return($data);
         }
     }
     if (!check_ipop_limit(CLIENT_IP, "send_sms_code", SMS_TIMESPAN)) {
         showErr("请勿频繁发送短信", 1);
     }
     $mobile_phone = $GLOBALS['db']->getOne("select mobile from " . DB_PREFIX . "supplier_account where supplier_id=" . $s_account_info['supplier_id'] . " and is_main=1");
     if (empty($mobile_phone)) {
         $data['status'] = false;
         $data['info'] = "商户未提供验证手机号,请联系管理员";
         ajax_return($data);
     }
     //删除失效验证码
     $sql = "DELETE FROM " . DB_PREFIX . "sms_mobile_verify WHERE add_time <=" . (NOW_TIME - SMS_EXPIRESPAN);
     $GLOBALS['db']->query($sql);
     $mobile_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "sms_mobile_verify where mobile_phone = '" . $mobile_phone . "'");
     if ($mobile_data) {
         //重新发送未失效的验证码
         $code = $mobile_data['code'];
         $mobile_data['add_time'] = NOW_TIME;
         $GLOBALS['db']->query("update " . DB_PREFIX . "sms_mobile_verify set add_time = '" . $mobile_data['add_time'] . "',send_count = send_count + 1 where mobile_phone = '" . $mobile_phone . "'");
     } else {
         $code = rand(100000, 999999);
         $mobile_data['mobile_phone'] = $mobile_phone;
         $mobile_data['add_time'] = NOW_TIME;
         $mobile_data['code'] = $code;
         $mobile_data['ip'] = CLIENT_IP;
         $GLOBALS['db']->autoExecute(DB_PREFIX . "sms_mobile_verify", $mobile_data, "INSERT", "", "SILENT");
     }
     send_verify_sms($mobile_phone, $code);
     es_session::delete("verify");
     //删除图形验证码
     $data['status'] = true;
     $data['info'] = "发送成功";
     $data['lesstime'] = SMS_TIMESPAN - (NOW_TIME - $mobile_data['add_time']);
     //剩余时间
     $data['sms_ipcount'] = load_sms_ipcount();
     ajax_return($data);
 }
 public function get_verify_code()
 {
     if (app_conf("SMS_ON") == 0) {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['SMS_OFF'];
         ajax_return($data);
     }
     $lottery_mobile = addslashes(htmlspecialchars(trim($_REQUEST['lottery_mobile'])));
     $user_id = intval($GLOBALS['user_info']['id']);
     if ($user_id == 0) {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['PLEASE_LOGIN_FIRST'];
         ajax_return($data);
     }
     if ($lottery_mobile == '') {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['LOTTERY_MOBILE_EMPTY'];
         ajax_return($data);
     }
     if (!check_mobile($lottery_mobile)) {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
         ajax_return($data);
     }
     //验证手机号的唯一购买
     $lottery_rs = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "lottery as l left join " . DB_PREFIX . "deal_cart as dc on dc.deal_id = l.deal_id where l.user_id <> " . $user_id . " and l.mobile = '" . $lottery_mobile . "'");
     //以上查询是否参与过本期相关的抽奖
     //查询是否有用户绑定
     $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where lottery_mobile = '" . $lottery_mobile . "' and lottery_verify = ''");
     if ($lottery_rs > 0 || $user) {
         if ($user['id'] == intval($GLOBALS['user_info']['id'])) {
             $data['status'] = 1;
             $data['info'] = $GLOBALS['lang']['MOBILE_VERIFIED'];
         } else {
             $data['status'] = 0;
             $data['info'] = $GLOBALS['lang']['MOBILE_USED_LOTTERY'];
         }
         ajax_return($data);
     }
     if (!check_ipop_limit(get_client_ip(), "lottery_verify", 300, 0)) {
         $data['status'] = 0;
         $data['info'] = $GLOBALS['lang']['LOTTERY_SEND_FAST'];
         ajax_return($data);
     }
     //开始生成手机验证
     $code = rand(1111, 9999);
     $GLOBALS['db']->query("update " . DB_PREFIX . "user set lottery_verify = '" . $code . "',lottery_mobile = '" . $lottery_mobile . "',verify_create_time = '" . get_gmtime() . "' where id = " . $user_id);
     send_verify_sms($lottery_mobile, $code);
     $data['status'] = 1;
     $data['info'] = $GLOBALS['lang']['LOTTERY_VERIFY_SEND_OK'];
     ajax_return($data);
 }
示例#10
0
/**
 * $is_only 是否必须验证手机唯一性$is_belong_user该手机号是否是用户的绑定手机号
 */
function send_code_function($mobile, $is_only, $email, $pwd, $is_belong_user)
{
    // $is_only = intval ( $_REQUEST ['is_only'] );
    // is_only 为1的话,表示不允许手机号重复
    if (app_conf("SMS_ON") == 0) {
        $data['status'] = 0;
        $data['info'] = "短信未开启";
        return $data;
    }
    if ($mobile == '') {
        $data['status'] = 0;
        $data['info'] = "请输入你的手机号";
        return $data;
    }
    if (!check_mobile($mobile)) {
        $data['status'] = 0;
        $data['info'] = "请填写正确的手机号码";
        return $data;
    }
    if ($is_only == 1) {
        $condition_1 = " and mobile='" . $mobile . "' ";
        $user = user_check($email, $pwd);
        $user_id = intval($user['id']);
        if ($user_id > 0) {
            $condition_1 .= " and id!=" . $user_id;
        }
        if ($GLOBALS['db']->getOne("select count(*) from  " . DB_PREFIX . "user where 1=1 {$condition_1} ") > 0) {
            $data['status'] = 0;
            $data['info'] = "该手机号已经存在";
            return $data;
        }
        if ($is_belong_user == 1 && $user_id > 0) {
            if ($user['mobile'] != '') {
                if ($user['mobile'] != $mobile) {
                    $data['status'] = 0;
                    $data['info'] = "亲!该手机号不是您绑定的手机号码!";
                    return $data;
                } else {
                    //继续执行
                }
            } else {
                //继续执行
            }
        }
    }
    $field_name = addslashes(trim($_REQUEST['mobile']));
    $field_data = $mobile;
    require_once APP_ROOT_PATH . "system/libs/user.php";
    $res = check_user($field_name, $field_data);
    $result = array("status" => 1, "info" => '');
    if (!$res['status']) {
        $error = $res['data'];
        if (!$error['field_show_name']) {
            $error['field_show_name'] = "手机号码";
        }
        if ($error['error'] == EMPTY_ERROR) {
            $error_msg = sprintf("手机号码不能为空", $error['field_show_name']);
        }
        if ($error['error'] == FORMAT_ERROR) {
            $error_msg = sprintf("格式错误,请重新输入", $error['field_show_name']);
        }
        if ($error['error'] == EXIST_ERROR) {
            $error_msg = sprintf("已存在,请重新输入", $error['field_show_name']);
        }
        $result['status'] = 0;
        $result['info'] = $error_msg;
        return $data;
    }
    if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
        $data['status'] = 0;
        $data['info'] = "发送速度太快了";
        return $data;
    }
    if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and client_ip='" . get_client_ip() . "' and create_time>=" . (get_gmtime() - 60) . " ORDER BY id DESC") > 0) {
        $data['status'] = 0;
        $data['info'] = "发送速度太快了";
        return $data;
    }
    $n_time = get_gmtime() - 300;
    // 删除超过5分钟的验证码
    $GLOBALS['db']->query("DELETE FROM " . DB_PREFIX . "mobile_verify_code WHERE create_time <=" . $n_time);
    // 开始生成手机验证
    $code = rand(100000, 999999);
    $GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_verify_code", array("verify_code" => $code, "mobile" => $mobile, "create_time" => get_gmtime(), "client_ip" => get_client_ip()), "INSERT");
    send_verify_sms($mobile, $code);
    $data['status'] = 1;
    $data['info'] = "验证码发送成功";
    return $data;
}
示例#11
0
 public function do_unsubscribe()
 {
     //开始发送验证码
     if (check_ipop_limit(CLIENT_IP, "sms_send_code_un", intval(app_conf("SUBMIT_DELAY")))) {
         $mobile = addslashes(trim($_REQUEST['mobile']));
         $verify = md5(trim($_REQUEST['verify']));
         $session_verify = es_session::get('verify');
         if ($verify != $session_verify) {
             $result['type'] = 0;
             $result['message'] = $GLOBALS['lang']['VERIFY_CODE_ERROR'];
             ajax_return($result);
         }
         $mobile_subscribe = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "mobile_list where mobile='" . $mobile . "' and is_effect = 1");
         if (!$mobile_subscribe) {
             $result['type'] = 0;
             $result['message'] = $GLOBALS['lang']['MOBILE_NOT_SUBSCRIBE'];
             ajax_return($result);
         }
         $code = rand(1111, 9999);
         $GLOBALS['db']->query("update " . DB_PREFIX . "mobile_list set verify_code = '" . $code . "' where id = " . $mobile_subscribe['id']);
         send_verify_sms($mobile_subscribe['mobile'], $code);
         $result['type'] = 1;
         ajax_return($result);
     } else {
         $result['type'] = 0;
         $result['message'] = $GLOBALS['lang']['SUBMIT_TOO_FAST'];
         ajax_return($result);
     }
 }
示例#12
0
 public function send_change_mobile_verify_code()
 {
     if (app_conf("SMS_ON") == 0) {
         $data['status'] = 0;
         $data['info'] = "短信未开启";
         ajax_return($data);
     }
     $mobile = addslashes(htmlspecialchars(trim($_REQUEST['mobile'])));
     $step = intval($_REQUEST['step']);
     $old_mobile = $GLOBALS["user_info"]['mobile'];
     if ($step == 1) {
         if ($old_mobile == $mobile) {
             $data['status'] = 0;
             $data['info'] = "你输入的手机号与原先一样";
             ajax_return($data);
         }
         $m_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where mobile='" . $mobile . "' ");
         if ($m_count > 0) {
             $data['status'] = 0;
             $data['info'] = "你输入的手机号已存在";
             ajax_return($data);
         }
     } elseif ($step == 2) {
         //单纯发送验证短信
         if ($mobile == '') {
             $mobile = $GLOBALS["user_info"]['mobile'];
         }
     } elseif ($step == 0) {
         $m_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where mobile='" . $mobile . "' ");
         if (!$m_count) {
             $data['status'] = 0;
             $data['info'] = "你输入的手机号非会员手机号";
             ajax_return($data);
         }
     }
     if ($mobile == '') {
         $data['status'] = 0;
         $data['info'] = "请输入你的手机号";
         ajax_return($data);
     }
     if (!check_mobile($mobile)) {
         $data['status'] = 0;
         $data['info'] = "请填写正确的手机号码";
         ajax_return($data);
     }
     $field_name = addslashes(trim($_REQUEST['mobile']));
     $field_data = $mobile;
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $res = check_user($field_name, $field_data);
     $result = array("status" => 1, "info" => '');
     if (!check_ipop_limit(get_client_ip(), "mobile_verify_" . $step, 60, 0)) {
         $data['status'] = 0;
         $data['info'] = "发送速度太快了";
         ajax_return($data);
     }
     if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and client_ip='" . get_client_ip() . "' and create_time>=" . (get_gmtime() - 60) . " ORDER BY id DESC") > 0) {
         $data['status'] = 0;
         $data['info'] = "发送速度太快了";
         ajax_return($data);
     }
     $n_time = get_gmtime() - 300;
     //删除超过5分钟的验证码
     $GLOBALS['db']->query("DELETE FROM " . DB_PREFIX . "mobile_verify_code WHERE create_time <=" . $n_time);
     //开始生成手机验证
     $code = rand(100000, 999999);
     $GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_verify_code", array("verify_code" => $code, "mobile" => $mobile, "create_time" => get_gmtime(), "client_ip" => get_client_ip()), "INSERT");
     send_verify_sms($mobile, $code);
     $data['status'] = 1;
     $data['info'] = "验证码发送成功";
     ajax_return($data);
 }