本文整理汇总了PHP中GWF_Session::get方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_Session::get方法的具体用法?PHP GWF_Session::get怎么用?PHP GWF_Session::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GWF_Session
的用法示例。
在下文中一共展示了GWF_Session::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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)));
}
示例2: chdir
<?php
chdir('../../');
define('GWF_PAGE_TITLE', 'Fremes');
require_once 'challenge/html_head.php';
require_once GWF_CORE_PATH . 'module/WeChall/solutionbox.php';
if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) {
$chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 4, 'challenge/FREMES/index.php', false);
}
$chall->showHeader();
if (false !== ($answer = Common::getPostString('answer', false))) {
if (false === ($key = GWF_Session::get('FREMEN_KEY', false))) {
echo GWF_HTML::error('Fremes', $chall->lang('err_try'));
} else {
$solution = GWF_Numeric::baseConvert($key, 2, 16);
$slen = strlen($solution);
$wlen = 128 / 4;
$nlen = $wlen - $slen;
$solution = str_repeat('0', $nlen) . $solution;
$answer = strtoupper($answer);
$solution = strtoupper($solution);
if ($answer === $solution || substr($answer, 2) === $solution) {
$chall->onChallengeSolved(GWF_Session::getUserID());
} else {
echo WC_HTML::error('err_wrong');
}
}
}
echo GWF_Box::box($chall->lang('info', array(128, 'fremes.php')), $chall->lang('title'));
echo formSolutionbox($chall);
require_once 'challenge/html_foot.php';
示例3: salesman_check_answer_B
function salesman_check_answer_B(WC_Challenge $chall, $answer)
{
// if ($answer === 'cheat')
// {
// return true;
// }
if (0 === preg_match_all('/((\\d+)([A-Z]+))/i', $answer, $matches)) {
echo $chall->lang('err_format') . PHP_EOL;
return false;
}
GWF_Session::remove('WCC_TR_CU_LEVEL_HAS_PB');
$list = GWF_Session::get('WCC_TR_CU_LIST');
$amounts = $matches[2];
$names = $matches[3];
$len = count($names);
$price = 0;
$amount = 0;
$stock = GWF_Session::getOrDefault('WCC_TR_CU_STOCK', 1);
$stocks = array();
for ($i = 0; $i < $len; $i++) {
$name = $names[$i];
$amt = $amounts[$i];
if (!is_numeric($amt)) {
echo $chall->lang('err_item_num', array($name)) . PHP_EOL;
continue;
}
$amt = (int) $amt;
if ($amt < 0) {
echo $chall->lang('err_item_num', array($name)) . PHP_EOL;
continue;
}
if (isset($stocks[$name])) {
$stocks[$name] += $amt;
} else {
$stocks[$name] = $amt;
}
if ($stocks[$name] > $stock) {
echo $chall->lang('err_item_stock', array($stocks[$name], $name, $stock)) . PHP_EOL;
continue;
}
$amount += $amt;
if (!array_key_exists($name, $list)) {
echo $chall->lang('err_item', array($name)) . PHP_EOL;
continue;
}
$p = $list[$name];
$price += $amt * $p;
}
$correct = true;
$correct_amt = salesman_itemcount();
if ($amount !== $correct_amt) {
echo $chall->lang('err_item_count', array($amount, $correct_amt)) . PHP_EOL;
$correct = false;
}
$correct_price = GWF_Session::get('WCC_TR_CU_PRICE');
if ($price !== $correct_price) {
echo $chall->lang('err_price', array($price, $correct_price)) . PHP_EOL;
$correct = false;
}
$now = microtime(true);
$start = GWF_Session::get('WCC_TR_CU_TIME');
$needed = $now - $start;
if ($needed > WCC_TR_CU_TIMEOUT) {
echo $chall->lang('err_timeout', array(sprintf('%.02f', $needed), WCC_TR_CU_TIMEOUT)) . PHP_EOL;
$correct = false;
}
return $correct;
}
示例4: zreload_do_before_actions
function zreload_do_before_actions()
{
# Do action for level
$actions = zshellzActionsBefore(GWF_Session::get('zreload'));
foreach ($actions as $action => $data) {
zreloadAction($action, $data);
}
}
示例5: validateToken
/**
* Validate token from get or post data.
* @param array $array
* @return $userdata
*/
public static function validateToken()
{
# POST or GET?
if (count($_POST) > 1) {
# Sometimes there is one var in the POST Oo
$array =& $_POST;
} else {
$array =& $_GET;
}
if (count($array) > 0) {
if (!isset($array[self::TOKEN_NAME]) || !is_string($array[self::TOKEN_NAME])) {
return false;
}
if (!GWF_Session::exists(self::TOKEN_NAME)) {
return false;
}
$token = $array[self::TOKEN_NAME];
$tokens =& GWF_Session::get(self::TOKEN_NAME);
foreach ($tokens as $id => $d) {
if (intval($d[0], 10) < time() - 7200) {
unset($tokens[$id]);
} elseif ($id === $token) {
$back = (string) $d[1];
unset($tokens[$id]);
unset($array[self::TOKEN_NAME]);
return $back;
}
}
return false;
}
return true;
}
示例6: AudioPhpCaptcha
function AudioPhpCaptcha($sFlitePath = CAPTCHA_FLITE_PATH, $sAudioPath = CAPTCHA_AUDIO_PATH)
{
$this->SetFlitePath($sFlitePath);
$this->SetAudioPath($sAudioPath);
// retrieve code if already set by previous instance of visual PhpCaptcha
if (Session::exists(CAPTCHA_SESSION_ID)) {
$this->sCode = GWF_Session::get(CAPTCHA_SESSION_ID);
}
}