<?php use Tsugi\Core\LTIX; use Tsugi\Util\LTI; use Tsugi\Util\Mersenne_Twister; $sanity = array('urllib' => 'You should use urllib to retrieve the data from the URL', 'BeautifulSoup' => 'You should use the BeautifulSoup library to parse the HTML'); // Compute the stuff for the output $code = 42; $new = getShuffledNames($code); $nums = getRandomNumbers($code, min(50, count($new)), 100); $sum_sample = array_sum($nums); $code = $USER->id + $LINK->id + $CONTEXT->id; $new = getShuffledNames($code); $nums = getRandomNumbers($code, min(50, count($new)), 100); $sum = array_sum($nums); $oldgrade = $RESULT->grade; if (isset($_POST['sum']) && isset($_POST['code'])) { $RESULT->setJsonKey('code', $_POST['code']); if ($_POST['sum'] != $sum) { $_SESSION['error'] = "Your sum did not match"; header('Location: ' . addSession('index.php')); return; } $val = validate($sanity, $_POST['code']); if (is_string($val)) { $_SESSION['error'] = $val; header('Location: ' . addSession('index.php')); return; } LTIX::gradeSendDueDate(1.0, $oldgrade, $dueDate); // Redirect to ourself
$sample_last = $name; $sample_names[] = $name; } if (isset($_SESSION['debug']) && is_string($_SESSION['debug'])) { $code = array_search($_SESSION['debug'], $NAMES); $name = $_SESSION['debug']; } else { $code = $USER->id + $LINK->id + $CONTEXT->id; $names = getShuffledNames($code); $name = $names[$actual_pos]; } $actual_names = array(); $actual_names[] = $name; for ($p = 0; $p < $actual_pages; $p++) { $code = array_search($name, $NAMES); $names = getShuffledNames($code); $name = $names[$actual_pos]; $actual_last = $name; $actual_names[] = $name; } $oldgrade = $RESULT->grade; if (isset($_POST['name']) && isset($_POST['code'])) { if ($USER->instructor && strpos($_POST['name'], '42') === 0) { $pieces = explode(',', $_POST['name']); $_SESSION['success'] = "Debug Mode Unlocked"; if (count($pieces) == 2) { $_SESSION['debug'] = $pieces[1]; } else { $_SESSION['debug'] = true; } header('Location: ' . addSession('index.php'));