本文整理匯總了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) {