当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Challenge类代码示例

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


在下文中一共展示了WC_Challenge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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('gizmore@wechall.net');
    # 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


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