Exemple #1
0
 public function execute()
 {
     if (false === ($this->user = GWF_Session::getUser())) {
         return GWF_HTML::err('ERR_LOGIN_REQUIRED');
     }
     $this->module->includeClass('WC_Warbox');
     $this->module->includeClass('WC_Warflag');
     $this->module->includeClass('WC_SiteAdmin');
     $this->module->includeClass('WC_SiteCats');
     $this->module->includeClass('sites/warbox/WCSite_WARBOX');
     if (false === ($this->warbox = WC_Warbox::getByID(Common::getGetString('wbid')))) {
         return WC_HTML::error('err_warbox');
     }
     if (!$this->warbox->hasEditPermission($this->user)) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     if (isset($_GET['edit'])) {
         if (false === ($this->flag = WC_Warflag::getByID(Common::getGetString('edit')))) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         if (isset($_POST['edit'])) {
             return $this->onEdit();
         } else {
             return $this->templateEdit();
         }
     }
     if (isset($_POST['add'])) {
         return $this->onAdd();
     }
     if (isset($_GET['add'])) {
         return $this->templateAdd();
     }
     if (isset($_POST['import'])) {
         return $this->onCSVImport();
     }
     if (isset($_GET['export'])) {
         return $this->onCSVExport();
     }
     if (isset($_GET['up'])) {
         return $this->onUp() . $this->templateOverview();
     } elseif (isset($_GET['down'])) {
         return $this->onDown() . $this->templateOverview();
     }
     return $this->templateOverview();
 }
Exemple #2
0
function sidologyRemixCheckAnswer(WC_Challenge $chall, $answer)
{
    if (false !== ($error = $chall->isAnswerBlocked(GWF_User::getStaticOrGuest()))) {
        echo $error;
        return;
    }
    $solution = '726f3a30c8ae485b4f34d5ff0fed05552d3da60b';
    # :) HappyCracking!
    $hash = $answer;
    for ($i = 0; $i < 100000; $i++) {
        $hash = sha1($hash);
    }
    // 	echo "$hash<br/>\n";
    if ($hash === $solution) {
        $chall->onChallengeSolved();
    } else {
        echo WC_HTML::error('err_wrong');
    }
}
Exemple #3
0
<?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';