本文整理匯總了PHP中WC_Challenge::onSolve方法的典型用法代碼示例。如果您正苦於以下問題:PHP WC_Challenge::onSolve方法的具體用法?PHP WC_Challenge::onSolve怎麽用?PHP WC_Challenge::onSolve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WC_Challenge
的用法示例。
在下文中一共展示了WC_Challenge::onSolve方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
示例2: ttr2_submit
function ttr2_submit(WC_Challenge $chall)
{
if ('' === ($answer = Common::getPostString('answer', ''))) {
return;
}
$sessid = GWF_Session::getSessSID();
# First check all "custom" solutions
$solutions = TTR2_Tokens::getSolutions($sessid);
foreach ($solutions as $solution) {
if ($solution['ttr_token'] === $answer) {
echo GWF_HTML::message($chall->lang('title'), $chall->lang('msg_reset_own', array(htmlspecialchars($solution['ttr_email']))));
return;
}
}
# Now lets check "THE" solution
$solution = TTR2_Tokens::getSolution($sessid);
$chall->setSolution($solution['ttr_token']);
$chall->onSolve(GWF_User::getStaticOrGuest(), $answer);
}