本文整理汇总了PHP中Utility::VerifyCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Utility::VerifyCode方法的具体用法?PHP Utility::VerifyCode怎么用?PHP Utility::VerifyCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility::VerifyCode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Create
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;
}
}
示例2: Secret
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;
}
示例3: Create
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);
}
}
示例4: Create
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);
}
}
}
示例5: Create
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);
}
示例6: sms_secret
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']));
示例7: redirect
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');
示例8: json
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) {