Files
cwsvJudo/homepage/participo/api.starter.add.php
2025-12-07 20:40:33 +01:00

28 lines
927 B
PHP

<?php
/** @var array $CONFIG basic configurations (defined via bootstraping) */
/** @var array $SECRETS passwords and other stuff worth of protection (defined via bootstraping) */
require_once "bootstrap.php";
// (local specific) settings
// @todo remove ore move to bootstrapping
require_once "config.php";
require_once "participoLib/dbConnector.php";
require_once "participoLib/participo.php";
require_once "participoLib/planer.php";
participo::init(config: $CONFIG["cwsvJudo"], secrets: $SECRETS["cwsvJudo"]);
$eventId = $_POST["eventId"] ?? null;
$startingTypeId = $_POST["type"] ?? null;
$starterId = $_POST["userId"] ?? null;
$returnToUrl = $_POST["returnToUrl"] ?? "participo/";
// @todo Check against deadline?
$newStarter = new Starter(null, $eventId, $startingTypeId, $starterId);
$newStarterId = $newStarter->addToDb();
header("Location: " . urldecode($returnToUrl), true, 301);
exit(-1); // shouldn't matter