Ejemplo n.º 1
0
 public function sendphone()
 {
     $phone = htmlspecialchars($_POST['cellphone']);
     $code = rand_string_reg(6, 1, 2);
     $result = sendsms($phone, '验证码为:' . $code);
     $this->ajaxReturn(array('status' => $result));
 }
Ejemplo n.º 2
0
 public function sendpswphone()
 {
     if ($_SESSION['retrieve_name']) {
         $vo = M('members')->field('user_name,user_phone')->where(array('user_name' => $_SESSION['retrieve_name']))->find();
         if (!$vo['user_phone']) {
             echo 'no';
             exit;
         }
         $code = rand_string_reg(6, 1, 2);
         $msg = session('retrieve_name') . '您好,你正在使用手机修改密码,您的验证码是:' . $code;
         $res = sendsms($vo['user_phone'], $msg);
         if (true == $res) {
             session('retrieve_phone', $vo['user_phone']);
             echo 1;
             exit;
         } else {
             exit('no');
         }
     } else {
         session('retrieve_name', '');
         echo 'no';
         exit;
     }
 }
Ejemplo n.º 3
0
 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_reg(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;
     // 		$updata2['cell_phone'] = $phone;
     // 		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);
     }
 }
 /**
 获取手机验证码
 */
 function phone()
 {
     $smsTxt = FS("Webconfig/smstxt");
     $smsTxt = de_xie($smsTxt);
     if (preg_match('#^13[\\d]{9}$|14^[0-9]\\d{8}|^15[0-9]\\d{8}$|^18[0-9]\\d{8}$#', $_POST['phone']) == 0) {
         echo "3";
         die;
     } else {
         $phone = text($_POST['phone']);
     }
     //$phone = text($_POST['phone']);
     $code = rand_string_reg(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']));
     }
     //	dump(session('code_temp'));
     if ($res) {
         echo "1";
     } else {
         echo "0";
     }
 }