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))); }
function checkSolution(WC_Challenge $chall) { if (false === ($correct = GWF_Session::getOrDefault('lg_solution'))) { return htmlDisplayError($chall->lang('err_no_req')); } $maxtime = LETTERGRID_MAX_TIME; $timediff = microtime(true) - GWF_Session::getOrDefault('lg_timeout', 0); if ($correct !== Common::getGet('solution')) { GWF_Session::remove('lg_timeout'); GWF_Session::remove('lg_solution'); return htmlDisplayError($chall->lang('err_wrong', array(htmlspecialchars(Common::getGet('solution'), ENT_QUOTES), $correct, $timediff, $maxtime))); } if ($timediff >= $maxtime) { return htmlDisplayError($chall->lang('err_slow', array($maxtime, $timediff))); } return htmlDisplayMessage($chall->lang('msg_correct', array($timediff))); }
function checkSolution(WC_Challenge $chall) { // if (!User::isLoggedIn()) { // return htmlDisplayError("You need to login to submit a solution."); // } if (false === ($correct = GWF_Session::getOrDefault('lw_solution'))) { return htmlDisplayError($chall->lang('err_no_req')); } $answer = Common::getGet('solution'); $maxtime = 4.5; $timediff = microtime(true) - GWF_Session::getOrDefault('lw_timeout', 0); if ($answer !== $correct) { GWF_Session::remove('lw_timeout'); GWF_Session::remove('lw_solution'); $danswer = htmlspecialchars($answer, ENT_QUOTES); return htmlDisplayError($chall->lang('err_wrong', array($danswer, $correct, $timediff, $maxtime))); } if ($timediff >= $maxtime) { return htmlDisplayError($chall->lang('err_slow', array($maxtime, $timediff))); } return htmlDisplayMessage($chall->lang('msg_correct', array($timediff))); }