public static function Create($mobile, $user_id, $secret = null, $enable = false)
 {
     if (!Utility::IsMobile($mobile, true)) {
         return;
     }
     $secret = $secret ? $secret : Utility::VerifyCode();
     $table = new Table('toolsbind', array('user_id' => $user_id, 'tools' => $mobile, 'enable' => $enable ? 'Y' : 'N', 'secret' => $secret));
     $condition = array('user_id' => $user_id, 'tools' => $mobile, 'enable' => 'N');
     $haveone = DB::GetTableRow('toolsbind', $condition);
     if ($haveone) {
         return Table::UpdateCache('toolsbind', $haveone['id'], array('secret' => $secret, 'enable' => 'N'));
     }
     //已经绑定了本号码
     $loginbind = array('user_id' => $user_id, 'tools' => $mobile, 'enable' => 'Y');
     $havebind = DB::GetTableRow('toolsbind', $loginbind);
     if ($havebind) {
         return false;
     }
     //$table->insert(array( 'user_id', 'tools','secret', 'enable'));
     DB::Insert('toolsbind', array('user_id' => $user_id, 'tools' => $mobile, 'secret' => $secret, 'enable' => 'N', 'create_time' => time()));
     $have = Table::Fetch('toolsbind', $mobile, 'tools');
     if ($have && 'Y' == $have['enable']) {
         return true;
     }
 }
 public static function Secret($mobile, $secret = null)
 {
     $secret = $secret ? $secret : Utility::VerifyCode();
     $sms = Table::Fetch('smssubscribe', $mobile, 'mobile');
     if ($sms) {
         Table::UpdateCache('smssubscribe', $sms['id'], array('secret' => $secret));
     }
     return $secret;
 }
Example #3
0
 public static function Create($order)
 {
     $team = Table::Fetch('team', $order['team_id']);
     $partner = Table::Fetch('partner', $order['partner_id']);
     $ccon = array('order_id' => $order['id']);
     $count = Table::Count('coupon', $ccon);
     while ($count < $order['quantity']) {
         $id = Utility::GenSecret(12, Utility::CHAR_NUM);
         $id = Utility::VerifyCode($id);
         $cv = Table::Fetch('coupon', $id);
         if ($cv) {
             continue;
         }
         $coupon = array('id' => $id, 'user_id' => $order['user_id'], 'partner_id' => $team['partner_id'], 'order_id' => $order['id'], 'credit' => $team['credit'], 'team_id' => $order['team_id'], 'secret' => Utility::GenSecret(6, Utility::CHAR_WORD), 'expire_time' => $team['expire_time'], 'create_time' => time());
         DB::Insert('coupon', $coupon);
         sms_coupon($coupon);
         $count = Table::Count('coupon', $ccon);
     }
 }
 public static function Create($order)
 {
     $team = Table::Fetch('team', $order['team_id']);
     //$partner = Table::Fetch('partner', $order['partner_id']);
     $ccon = array('order_id' => $order['id']);
     $count = Table::Count('code', $ccon);
     require dirname(dirname(dirname(__FILE__))) . "/zhongyu/Zhongyu.class.php";
     $zhongyu = new Zhongyu();
     while ($count < $order['quantity']) {
         $id = date('YmdHis', time()) . rand(100000, 999999);
         $id = Utility::VerifyCode($id);
         $cv = Table::Fetch('code', $id);
         if ($cv) {
             continue;
         }
         /* 这里请求第三方发码接口 */
         if ('zhongyu' == $team['codeform']) {
             //判断为中娱发码方式
             $codeform = 'zhongyu';
             $info = array('req_seq' => $id, 'serv_code' => $team['serv_code'], 'phone_rece' => $order['mobile'], 'notes' => '');
             $result = $zhongyu->send($info);
             //print_r($result);exit;
             $doc = new DOMDocument();
             $doc->loadXML($result);
             $response_id = $doc->getElementsByTagName("id")->item(0)->nodeValue;
             if ('0000' == $response_id) {
                 //成功
                 $sys_seq = $doc->getElementsByTagName("order_num")->item(0)->nodeValue;
                 $msg = $doc->getElementsByTagName("comment")->item(0)->nodeValue;
                 $mms = 1;
             } else {
                 //失败
                 $msg = $doc->getElementsByTagName("comment")->item(0)->nodeValue;
                 $mms = 0;
             }
         }
         $code = array('id' => $id, 'sys_seq' => $sys_seq, 'user_id' => $order['user_id'], 'partner_id' => $team['partner_id'], 'city_id' => $team['city_id'], 'order_id' => $order['id'], 'team_id' => $order['team_id'], 'expire_time' => $team['expire_time'], 'create_time' => time(), 'msg' => $msg, 'mms' => $mms, 'codeform' => $codeform);
         if (DB::Insert('code', $code)) {
             //sms_coupon($coupon);
             $count = Table::Count('code', $ccon);
         }
     }
 }
Example #5
0
	static public function Create($order) {
		$team = Table::Fetch('team', $order['team_id']);
		$partner = Table::Fetch('partner', $order['partner_id']);
		$ccon = array('order_id' => $order['id']);
		$count = Table::Count('coupon', $ccon);
		while($count<$order['quantity']) {
			/* 配合400验证,ID统一修改为12位伪随机数字,密码为6位数字 */
			$id = (ceil(time()/100)+rand(10000000,20000000));
			$id = Utility::VerifyCode($id);
			$cv = Table::Fetch('coupon', $id);
			if ($cv) continue;
            $coupon = array(
					'id' => $id,
					'user_id' => $order['user_id'],
					'buy_id' => $order['buy_id'],
					'partner_id' => $team['partner_id'],
					'order_id' => $order['id'],
					'credit' => $team['credit'],
					'team_id' => $order['team_id'],
					'secret' => Utility::VerifyCode(Utility::GenSecret(6, Utility::CHAR_NUM)),
					'expire_time' => $team['expire_time'],
					'create_time' => time(),
					);
			DB::Insert('coupon', $coupon);
			$count = Table::Count('coupon', $ccon);
			
			//send_goods_confirm_by_platform
			/**
			if( ($order['service']=='alipay') && ($INI['alipay']['autosendgoods']='Y') && ($INI['alipay']['guarantee']!='Y') ) {
				alipay_send_goods($order['trade_no']);		
			}
			*/
			
		}
		sms_all_coupon($order);
	}
Example #6
0
                sms_secret($mobile, $secret, false);
            }
        }
        json($html, 'dialog');
    } else {
        json('captcha_again();', 'eval');
    }
} else {
    if ('subscribe' == $action) {
        $html = render('ajax_dialog_smssub');
        json($html, 'dialog');
    } elseif ('subscribecheck' == $action) {
        $mobile = trim(strval($_GET['mobile']));
        $verifycode = trim(strval($_GET['verifycode']));
        $city_id = abs(intval($_GET['city_id']));
        $secret = Utility::VerifyCode();
        if (Utility::CaptchaCheck($verifycode)) {
            if (ZSMSSubscribe::Create($mobile, $city_id, $secret) === true) {
                $html = render('ajax_dialog_smssuc');
            } else {
                $html = render('ajax_dialog_smscode');
                sms_secret($mobile, $secret, true);
            }
            json($html, 'dialog');
        } else {
            json('captcha_again();', 'eval');
        }
    } else {
        if ('codeyes' == $action) {
            $mobile = trim(strval($_GET['mobile']));
            $secretcode = trim(strval($_GET['secretcode']));
Example #7
0
     Session::Set('error', '抱歉,这个邮箱没有在本站绑定过用户,试试<a style="color:#000" href="/account/repassmobile.php">手机号找回密码?</a>');
     redirect(WEB_ROOT . '/account/repass.php');
 } elseif (!empty($_POST['mobile'])) {
     if (!Utility::IsMobile($_POST['mobile'])) {
         Session::Set('error', '手机号码不正确');
         redirect(WEB_ROOT . '/account/repass.php');
     } else {
         $sended = DB::GetQueryResult("SELECT mobile FROM verifycode WHERE mobile='" . $_POST['mobile'] . "' AND status=3 AND getip='" . Utility::GetRemoteIp() . "' AND dateline>'" . (time() - 3600) . "'");
         if ($sended) {
             Session::Set('error', '每IP每手机号每小时只能找回一次密码');
             redirect(WEB_ROOT . '/account/repass.php');
         } else {
             $user = Table::Fetch('user', strval($_POST['mobile']), 'mobile');
             if ($user) {
                 //设置6位随机数字密码
                 $new_password = Utility::VerifyCode();
                 $content = $INI['system']['sitename'] . " 您的用户名:" . $user['username'] . " 新密码:" . $new_password . " 请及时修改密码。";
                 //长度不能超过70个字符
                 $ret = sms_send($_POST['mobile'], $content);
                 if ($ret === true) {
                     //插入获取验证码数据记录
                     $verifycode_data = array('mobile' => $_POST['mobile'], 'getip' => Utility::GetRemoteIp(), 'verifycode' => $new_password, 'dateline' => time(), 'reguid' => $user['id'], 'regdateline' => time(), 'status' => 3);
                     $table = new Table('verifycode', $verifycode_data);
                     $table->insert(array('mobile', 'getip', 'verifycode', 'dateline', 'reguid', 'regdateline', 'status'));
                     $password = ZUser::GenPassword($new_password);
                     Table::UpdateCache('user', $user['id'], array('password' => $password, 'recode' => ''));
                     Session::Set('notice', '成功发送找回密码短信到手机号:' . $_POST['mobile'] . ' 请稍候查看短信及时修改密码');
                     redirect(WEB_ROOT . '/account/repass.php');
                 } else {
                     Session::Set('error', '找回密码短信发送失败,错误码:' . $ret . '');
                     redirect(WEB_ROOT . '/account/repass.php');
Example #8
0
File: sms.php Project: noikiy/mdwp
     if (empty($mobile)) {
         json('手机号不能为空', 'alert');
     }
     if (!Utility::IsMobile($mobile)) {
         json('手机号码不正确', 'alert');
     }
     $exists = Table::Count('user', array('mobile' => $mobile));
     if ($exists >= 1) {
         json('此手机号已有会员绑定', 'alert');
     }
     $sended = DB::GetQueryResult("SELECT mobile FROM verifycode WHERE (status=4 or status=5) AND getip='" . Utility::GetRemoteIp() . "' AND dateline>'" . (time() - 3600) . "'");
     if ($sended) {
         json('每IP每手机号每小时只能获取一次验证码', 'alert');
     } else {
         //设置6位随机数字验证码
         $verifycode = Utility::VerifyCode();
         //发送验证码短信到手机
         $content = $INI['system']['sitename'] . " 您的手机号:" . $mobile . " 绑定验证码:" . $verifycode . " 一天内提交绑定有效。";
         //长度不能超过70个字符
         $ret = sms_send($mobile, $content);
         if ($ret === true) {
             //插入获取验证码数据记录
             $verifycode_data = array('mobile' => $mobile, 'getip' => Utility::GetRemoteIp(), 'verifycode' => $verifycode, 'dateline' => time(), 'status' => 4);
             $table = new Table('verifycode', $verifycode_data);
             $table->insert(array('mobile', 'getip', 'verifycode', 'dateline', 'status'));
             json('绑定验证码短信成功发送到手机号:' . $mobile . '', 'alert');
         } else {
             json('绑定验证码短信发送失败,错误码:' . $ret . '', 'alert');
         }
     }
 } elseif ('bindmobile_submit' == $action) {