include "functions.php";?>
$sessions = getSessions();
$proefSessie = getTestSession();
if(count($proefSessie)< 1 || count($proefSessie)> 1) {
die($_SESSION["translations"][$_COOKIE["lang"]]["FoutRegistratie"]);
}
$error_msg = "";
// Dont actually know if started, but hide the not started message
$sessionStarted = true;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if(isset($_POST["registreer"])){
$submitted = true;
// Attempt to register the user, combine first and last name as the db only has 1 name field
$Id = registerUser($_POST["sessie"], $_POST["groep"], $_POST["voornaam"] . " ". $_POST["achternaam"]);
if ($Id <= 0){
$error_msg=$_SESSION["translations"][$_COOKIE["lang"]]["FoutRegistratie"];
$submitted = false;
} else {
// Set the session parameters
$_SESSION["groep"] = $_POST["groep"];
$_SESSION["sessie"] = $_POST["sessie"];
$_SESSION["naam"] = $_POST["voornaam"] . " ". $_POST["achternaam"];
$_SESSION["userId"] = $Id;
$_SESSION["keuzes"] = array(0,0,0,0,0,0,0,0);
// If another session than the test session has been selected
if($_POST["sessie"] !== $proefSessie[0]["Id"]){
$_SESSION["test"] = false;
}
}
}
if(isset($_POST["start"])){
$submitted = true;
$sessionStarted = checkSessionStarted($_SESSION["sessie"]);
if($sessionStarted){
// Store the amount of users in the user's group in the session.
$_SESSION["AmountUsersGroup"] = getAmountUserPerGroup($_SESSION["sessie"], $_SESSION["groep"]);
echo '
';
}
}
}
?>
include "foot.php";?>