Example #1
0
<div class="clear"></div>
			<?php 
            include 'footer.php';
            die;
        }
    }
}
include 'header.php';
for ($challengeNumber = 1; $challengeNumber <= $challengeTotal; $challengeNumber++) {
    $challengeBits = explode('-', $challenges[$challengeNumber - 1]);
    if ($challengeId == trim($challengeBits[0])) {
        // We reached the current challenge, stop here.
        break;
    }
    $fakeId = trim($challengeBits[0]);
    $challenge = getChallengeData($fakeId);
    ?>
<div style="height: 80px;"></div>
<div class="clear"></div>
<div class="grid_6">
	<div style="padding-left: 10px;">
		<span class="bigText">#<?php 
    echo $challengeNumber;
    ?>
</span><span class="gray">/<?php 
    echo $challengeTotal;
    ?>
</span><br />
		<span class="serif normalText"><?php 
    echo h($challenge['title']);
    ?>
Example #2
0
*/
$require_login = true;
$title = 'Challenge';
$tab = 'current';
$noHeader = true;
include 'header.php';
// Contest organizer: Change these lines (to "true" or "false") if you want, but don't comment them out.
$showGender = false;
$showGrade = false;
if (!$challengeId) {
    // If there's no challenge any more, redirect to the scoreboard.
    header('Location: /scoreboard.php');
    die;
}
// Load the current challenge
$challenge = getChallengeData($challengeId);
// Load the user's old answers.
$answerFile = $dataDir . '/users/' . $user['id'] . '_answers.dat';
if (is_file($answerFile)) {
    $answers = unserialize(file_get_contents($answerFile));
} else {
    $answers = array();
}
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
    session_start();
    if ($_REQUEST['answers_id'] != $challengeId) {
        $_SESSION['error'] = 'Sorry, it looks like the time to submit your answers for that challenge has ended.';
        header('Location: /play.php', true, 303);
        die;
    }
    if (isset($answers[$challengeId])) {