• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WC_Challenge类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中WC_Challenge的典型用法代码示例。如果您正苦于以下问题:PHP WC_Challenge类的具体用法?PHP WC_Challenge怎么用?PHP WC_Challenge使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WC_Challenge类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: bacon_encode

function bacon_encode(WC_Challenge $chall, $hidden)
{
    $message = strtolower($chall->lang('message'));
    $len = strlen($hidden);
    $pos = -1;
    $a = ord('A');
    for ($i = 0; $i < $len; $i++) {
        $c = ord($hidden[$i]);
        $bin = decbin($c - $a);
        $bin = sprintf('%05d', $bin);
        for ($j = 0; $j < 5; $j++) {
            $pos = bacon_next_pos($message, $pos);
            if ($bin[$j] === '1') {
                $message[$pos] = strtoupper($message[$pos]);
            }
        }
    }
    $pos++;
    $len = strlen($message);
    while ($pos < $len) {
        $message[$pos] = strtoupper($message[$pos]);
        $pos += 2;
    }
    return $message;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:25,代码来源:index.php


示例2: hashgame_check_answer

function hashgame_check_answer(WC_Challenge $chall, $answer, array $list1, array $list2)
{
    $solutions = array_merge(hashgame_longest_two($list1), hashgame_longest_two($list2));
    $answers = explode(',', $answer);
    if (count($answers) !== 4) {
        echo GWF_HTML::error('HashGame', $chall->lang('err_answer_count', array(count($answers))), false);
        //		return false;
    }
    if (count($answers) > 4) {
        echo GWF_HTML::error('HashGame', $chall->lang('err_answer_count_high', array(count($answers))), false);
        $answers = array_slice($answers, 0, 4);
    }
    $correct = 0;
    foreach ($answers as $word) {
        $word = trim($word);
        foreach ($solutions as $i => $solution) {
            if ($word === $solution) {
                unset($solutions[$i]);
                $correct++;
                break;
            }
        }
    }
    if ($correct === 4) {
        $chall->onChallengeSolved(GWF_Session::getUserID());
    } else {
        echo GWF_HTML::error('HashGame', $chall->lang('err_some_good', array($correct)), false);
    }
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:29,代码来源:index.php


示例3: onVote

 public function onVote(WC_Challenge $chall)
 {
     if ('0' === ($userid = GWF_Session::getUserID())) {
         return GWF_HTML::err('ERR_LOGIN_REQUIRED');
     }
     if (!WC_ChallSolved::hasSolved($userid, $chall->getID())) {
         return $this->module->error('err_chall_vote');
     }
     $form = $this->getFormVote($chall, false, $userid);
     if (false !== ($error = $form->validate($this->module))) {
         return $error;
     }
     if (false !== ($vs = $chall->getVotesDif())) {
         $vs->onUserVoteSafe($_POST['dif'], $userid);
     }
     if (false !== ($vs = $chall->getVotesEdu())) {
         $vs->onUserVoteSafe($_POST['edu'], $userid);
     }
     if (false !== ($vs = $chall->getVotesFun())) {
         $vs->onUserVoteSafe($_POST['fun'], $userid);
     }
     if (false === WC_ChallSolved::setVoted($userid, $chall->getID(), true)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $chall->onRecalcVotes()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_chall_voted');
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:29,代码来源:ChallVotes.php


示例4: crypto_dig1_ciphertext

function crypto_dig1_ciphertext(WC_Challenge $chall)
{
    WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true);
    $solution = WC_CryptoChall::generateSolution('The22_GHDIdiiiiEEEEZZ', true, true);
    $pt = $chall->lang('plaintext', array($solution));
    $ct = crypto_dig1_encrypt($pt);
    return $ct;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:index.php


示例5: crypto_trans1_ciphertext

function crypto_trans1_ciphertext(WC_Challenge $chall)
{
    WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true, true);
    $solution = WC_CryptoChall::generateSolution('The_GHSUBBBBEEEEZZ', true, true);
    $pt = $chall->lang('plaintext', array($solution));
    $ct = crypto_trans1_encrypt($pt);
    $ct = str_replace(' ', '&nbsp;', $ct);
    return $ct;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:index.php


示例6: crypto_caesar_1_ciphertext

function crypto_caesar_1_ciphertext(WC_Challenge $chall)
{
    WC_CryptoChall::checkPlaintext(strtoupper($chall->lang('plaintext')));
    $solution = WC_CryptoChall::generateSolution('The Foo The Bar The Lee', true, true);
    $pt = $chall->lang('plaintext', array($solution));
    $pt = strtoupper($pt);
    $pt = preg_replace('/[^A-Z ]/', '', $pt);
    $ct = crypto_caesar_1_encrypt($pt);
    return $ct;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:10,代码来源:index.php


示例7: crypto_caesar_2_ciphertext

function crypto_caesar_2_ciphertext(WC_Challenge $chall)
{
    WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true);
    $solution = WC_CryptoChall::generateSolution('The_Foo!The!Bar_The!Lee', true, true);
    $pt = $chall->lang('plaintext', array($solution));
    //	$pt = strtoupper($pt);
    //	$pt = preg_replace('/[^A-Z]/', '', $pt);
    $ct = crypto_caesar_2_encrypt($pt);
    return WC_CryptoChall::hexdump($ct);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:10,代码来源:index.php


示例8: ttr2_mail_me

function ttr2_mail_me(WC_Challenge $chall, $email, $token)
{
    $mail = new GWF_Mail();
    $mail->setSender(GWF_BOT_EMAIL);
    $mail->setReceiver($email);
    $mail->setSubject($chall->lang('mail_subj'));
    $mail->setBody($chall->lang('mail_body', array($token)));
    $mail->sendAsHTML('[email protected]');
    # cc me for testing purposes
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:10,代码来源:reset.php


示例9: www_basic_go

function www_basic_go(WC_Challenge $chall, $url, $content)
{
    if (false === ($response = GWF_HTTP::getFromURL($url))) {
        echo GWF_HTML::error('WWW Basics', $chall->lang('err_file_not_found'));
    } elseif ($response !== $content) {
        echo GWF_HTML::error('WWW Basics', $chall->lang('err_wrong', array(htmlspecialchars($response), htmlspecialchars($content), strlen($response), strlen($content))));
    } else {
        $chall->onChallengeSolved(GWF_Session::getUserID());
    }
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:10,代码来源:index.php


示例10: wcc_ip6_check_answer

function wcc_ip6_check_answer(WC_Challenge $chall, $answer, $level)
{
    require_once 'solutions.php';
    if ($level === count($solutions)) {
        $ip = $_SERVER['REMOTE_ADDR'];
        if (GWF_IP6::isV6($ip)) {
            $chall->onChallengeSolved(GWF_Session::getUserID());
        }
        return false;
    }
    return in_array(strtolower($answer), $solutions[$level], true);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:12,代码来源:index.php


示例11: checkSolution

 public static function checkSolution(WC_Challenge $chall, $random, $letters_only = false, $lowercase = false, $length = 12)
 {
     if (false === ($answer = Common::getPostString('answer', false))) {
         return;
     }
     $solution = self::generateSolution($random, $letters_only, $lowercase, $length);
     if ($lowercase) {
         $answer = strtolower($answer);
     }
     $chall->setVar('chall_solution', WC_Challenge::hashSolution($solution, $lowercase));
     $chall->onSolve(GWF_Session::getUser(), $answer);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:12,代码来源:WC_CryptoChall.php


示例12: www_rewrite_go

function www_rewrite_go(WC_Challenge $chall, $url)
{
    $n1 = rand(1000000, 1000000000) . rand(1000000, 1000000000);
    $n2 = rand(1000000, 1000000000) . rand(1000000, 1000000000);
    $solution = bcmul($n1, $n2);
    $url .= $n1 . '_mul_' . $n2 . '.html';
    if (false === ($response = GWF_HTTP::getFromURL($url))) {
        echo GWF_HTML::error('WWW Rewrite', $chall->lang('err_file_not_found'));
    } elseif ($response !== $solution) {
        echo GWF_HTML::error('WWW Rewrite', $chall->lang('err_wrong', array(htmlspecialchars($response), htmlspecialchars($solution), strlen($response), strlen($solution))));
    } else {
        $chall->onChallengeSolved(GWF_Session::getUserID());
    }
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:14,代码来源:index.php


示例13: wccgpg_doit

function wccgpg_doit(WC_Challenge $chall, $user)
{
    if ($user === false) {
        echo GWF_HTML::error('GPG', $chall->lang('err_login'), false);
        return;
    }
    if (!$user->hasValidMail()) {
        echo GWF_HTML::error('GPG', $chall->lang('err_no_mail'));
        return;
    }
    $receiver = $user->getValidMail();
    if (!function_exists('gnupg_init')) {
        echo GWF_HTML::error('GPG', $chall->lang('err_server'));
        return;
    }
    if (false === ($fingerprint = GWF_PublicKey::getFingerprintForUser($user))) {
        $url = GWF_WEB_ROOT . 'account';
        echo GWF_HTML::error('GPG', $chall->lang('err_no_gpg', $url), false);
        return;
    }
    $solution = WC_CryptoChall::generateSolution('OHOYOUGOTGPG!', true, false);
    $mail = new GWF_Mail();
    $mail->setSubject($chall->lang('mail_s'));
    $mail->setSender(GWF_BOT_EMAIL);
    $mail->setReceiver($receiver);
    $mail->setBody($chall->lang('mail_b', array($user->displayUsername(), $solution)));
    if (false === $mail->sendToUser($user)) {
        echo GWF_HTML::err('ERR_MAIL_SENT');
    } else {
        echo GWF_HTML::message('GPG', $chall->lang('msg_mail_sent', array(htmlspecialchars($receiver))));
    }
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:32,代码来源:index.php


示例14: identity_filter

function identity_filter(WC_Challenge $chall)
{
    if (!isset($_POST['answer']) || !is_string($_POST['answer'])) {
        return;
    }
    $answer = $_POST['answer'];
    $answer = str_replace(array(' ', ','), '', $answer);
    $answer = strtolower($answer);
    $answer = str_replace('049', '0', $answer);
    if (strpos($answer, '17659598844') !== false) {
        echo GWF_HTML::error($chall->lang('title'), $chall->lang('err_home_phone'));
    }
    $_POST['answer'] = $answer;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:14,代码来源:index.php


示例15: __wakeup

 public function __wakeup()
 {
     if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) {
         $chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 2, 'challenge/are_you_serial/index.php');
     }
     $chall->onChallengeSolved(GWF_Session::getUserID());
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:SERIAL_Solution.php


示例16: train_regex_level_4

function train_regex_level_4(WC_Challenge $chall, $answer)
{
    $solution = '/^(wechall4?)\\.(?:jpg|gif|tiff|bmp|png)$/';
    $samples_good = array('wechall.jpg', 'wechall.gif', 'wechall.tiff', 'wechall.bmp', 'wechall.png', 'wechall4.jpg', 'wechall4.gif', 'wechall4.tiff', 'wechall4.bmp', 'wechall4.png');
    $samples_bad = array('wechall', 'wechall4', 'wechall3.png', 'wechall4.jpf', 'wechallpng', 'wechallxjpg', 'wechall.jpg ', ' wechall.jpg', 'mechall.jpg', 'meechll.jpg', 'wechall44.jpg', 'wecdfss.jpg');
    foreach ($samples_good as $t) {
        if (!preg_match($answer, $t, $matches)) {
            echo GWF_HTML::error('WeChall', $chall->lang('err_no_match', array($t)), false);
            return false;
        }
        $filename = Common::substrUntil($t, '.');
        if (count($matches) !== 2 || $filename !== $matches[1]) {
            echo GWF_HTML::error('WeChall', $chall->lang('err_not_capturing'), false);
            return false;
        }
    }
    foreach ($samples_bad as $t) {
        if (preg_match($answer, $t, $matches)) {
            echo GWF_HTML::error('WeChall', $chall->lang('err_matching', $t), false);
            return false;
        }
    }
    if (strlen($answer) > strlen($solution)) {
        echo GWF_HTML::error('WeChall', $chall->lang('err_too_long', array(strlen($solution))), false);
        return false;
    }
    return true;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:28,代码来源:index.php


示例17: checkSolution

function checkSolution(WC_Challenge $chall)
{
    if (false === ($correct = GWF_Session::getOrDefault('cyrm_solution'))) {
        return htmlDisplayError($chall->lang('err_no_request'));
    }
    $timediff = microtime(true) - GWF_Session::get('cyrm_timeout');
    $taken = sprintf('%.03fs', $timediff);
    if ($correct !== ($answer = Common::getGetString('solution', ''))) {
        return htmlDisplayError($chall->lang('err_wrong', array(htmlspecialchars($answer, ENT_QUOTES), $correct, $taken)));
    }
    $maxtime = 2.5;
    if ($timediff >= $maxtime) {
        return htmlDisplayError($chall->lang('err_slow', array($maxtime . 's', $taken)));
    }
    return htmlDisplayMessage($chall->lang('msg_correct', array($taken)));
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:16,代码来源:index.php


示例18: shadowlamb3solver

function shadowlamb3solver(WC_Challenge $chall, $answer)
{
    if (!GWF_Session::isLoggedIn()) {
        echo GWF_HTML::error('Shadowlamb', 'Better login first!');
        return;
    }
    $code = WC5Lamb_Solution::validateSolution3($answer, GWF_Session::getUserID());
    switch ($code) {
        case 1:
            echo GWF_HTML::message('Shadowlamb', $chall->lang('msg_right'));
            $chall->onChallengeSolved(GWF_Session::getUserID());
            break;
        default:
            echo GWF_HTML::error('Shadowlamb', $chall->lang('err_wrong_' . $code));
            break;
    }
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:17,代码来源:index.php


示例19: prog2CheckResult

function prog2CheckResult(WC_Challenge $chall)
{
    if (false === ($user = GWF_Session::getUser())) {
        die($chall->lang('err_login'));
    }
    if (false === ($answer = Common::getGet('answer'))) {
        die($chall->lang('err_no_answer'));
    }
    $solution = GWF_Session::getOrDefault('prog2_solution', false);
    $startTime = GWF_Session::getOrDefault('prog2_timeout', false);
    if ($solution === false || $startTime === false) {
        die($chall->lang('err_no_request'));
    }
    $back = "";
    if (trim($answer) !== $solution) {
        $back .= $chall->lang('err_wrong', array(htmlspecialchars($answer, ENT_QUOTES), $solution));
    } else {
        $back .= $chall->lang('msg_correct');
    }
    $timeNeeded = microtime(true) - $startTime;
    if ($timeNeeded > TIMELIMIT) {
        return $back . $chall->lang('err_timeout', array(sprintf('%.02f', $timeNeeded), TIMELIMIT));
    }
    return trim($answer) === $solution ? true : $back;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:25,代码来源:index.php


示例20: stalking_check_answer

function stalking_check_answer(WC_Challenge $chall, $answer)
{
    $answer = mb_strtolower($answer);
    // To Lower
    $answer = str_replace(' ', '', $answer);
    // No Spaces
    $sections = explode(',', $answer);
    $sc = count($sections);
    if ($sc !== 4) {
        return $chall->lang('err_sections', array($sc));
    }
    list($company, $coworker, $brother, $band) = $sections;
    if (stalking_company($company) && stalking_coworker($coworker) && stalking_brother($brother) && stalking_band($band)) {
        return false;
    } else {
        return $chall->lang('err_wrong');
    }
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:18,代码来源:stalking_solution.php



注:本文中的WC_Challenge类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP WC_Checkout类代码示例发布时间:2022-05-23
下一篇:
PHP WC_Cache_Helper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap