本文整理汇总了PHP中Authenticator::restore方法的典型用法代码示例。如果您正苦于以下问题:PHP Authenticator::restore方法的具体用法?PHP Authenticator::restore怎么用?PHP Authenticator::restore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authenticator
的用法示例。
在下文中一共展示了Authenticator::restore方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
switch ($method) {
case "new":
if (count($argv) == 3) {
$auth = Authenticator::generate($argv[2]);
$message = "New Authenticator requested";
}
break;
case "generate":
if (count($argv) == 4) {
$auth = Authenticator::factory($argv[2], $argv[3]);
$message = "Generate codes";
}
break;
case "restore":
if (count($argv) == 4) {
$auth = Authenticator::restore($argv[2], $argv[3]);
$message = "Restore requested";
}
break;
}
if ($auth === false) {
usage();
exit(1);
}
echo $message . " - Serial: " . $auth->serial() . " Secret: " . $auth->secret() . " Restore: " . $auth->restore_code() . "\r\n\r\n";
while (true) {
$code = $auth->code();
echo "key: {$code}\r\n";
$wait = 1 + ($auth->waitingtime() - $auth->elapsedtime()) / 1000;
echo 'waiting for ' . $wait . " sec\r\n\r\n";
sleep($wait);
示例2: db_iconv
if (check_data("letters_code")) {
$postcode = db_iconv("letters_code");
if (md5(strtolower($postcode)) == $_SESSION['letters_code']) {
if (check_data('authname') && check_data('region') && check_data('authcodeA3') && check_data('authcodeB3') && check_data('authcodeC3') && check_data('authrestore') && check_data('selectpic')) {
$region = db_iconv('region', "post", TRUE, true);
$athcode1 = db_iconv('authcodeA3', "post", TRUE, true);
$athcode2 = db_iconv('authcodeB3', "post", TRUE, true);
$athcode3 = db_iconv('authcodeC3', "post", TRUE, true);
$authname = db_iconv('authname', "post", TRUE, true);
$selectpic = db_iconv('selectpic', "post", TRUE, true);
$authrestorecode = db_iconv('authrestore', "post", TRUE, true);
if (checkauthname($authname) && checkauthregion($region) && checkauthselectpic($selectpic) && checkauthselectcode($athcode1) && checkauthselectcode($athcode2) && checkauthselectcode($athcode3) && checkauthselectrestorecode($authrestorecode)) {
try {
$region = $strregion[$region];
$authserial = "{$region}-{$athcode1}-{$athcode2}-{$athcode3}";
$auth = @Authenticator::restore($authserial, $authrestorecode);
$authserect = $auth->secret();
//$authsynctime = $auth->getsync();
if (checkauthname('morenauthset')) {
$morenauthset = db_iconv('morenauthset', "post", TRUE, true);
if ($morenauthset == "on") {
update("UPDATE `authdata` SET `auth_moren`=0 WHERE `user_id`='{$user_id}' AND `auth_moren`=1");
$auth_moren = 1;
}
}
if (queryValue("SELECT COUNT(*) FROM `authdata` WHERE `user_id`='{$user_id}' AND `auth_moren`=1") == 0) {
$auth_moren = 1;
}
if (is_null($authserial)) {
$authaddbyrestoreerrorid = 5;
} else {