function submitNewRound($roundname, $roundanswer) { if ($roundname == "") { printf("<div class='errormsg'>Blank Round Name is unacceptable. Try again</div>\n"); return FALSE; } if ($roundanswer == "") { printf("<div class='errormsg'>Blank Round Answer is unacceptable. Try again</div>\n"); return FALSE; } createRound($roundname, $roundanswer); printf("<div class='okmsg'>Added new Round: %s with meta answer: %s</div>\n", htmlspecialchars($roundname), htmlspecialchars($roundanswer)); return TRUE; }
<?php include_once 'procedures.php'; $echoAnswer = ""; if (!isAdmin()) { echo "Нет полномочий"; exit; } if (isset($_POST['createAndStart'])) { $roundId = createRound(intval($_POST['tournamentId']), $_POST['roundName'], intval($_POST['checker']), intval($_POST['previousRound']), intval($_POST['seed'])); if ($roundId >= 0) { include 'startRound.php'; $echoAnswer = "Раунд начался!"; } else { $echoAnswer = "Произошла ошибка во время создания раунда!"; } } else { if (isset($_POST['createRound'])) { $answer = createRoundErr(intval($_POST['tournamentId']), $_POST['roundName'], intval($_POST['checker']), intval($_POST['previousRound']), intval($_POST['seed'])); switch ($answer) { case 0: $echoAnswer = "Раунд успешно создан!"; break; case 1: $echoAnswer = "Произошла ошибка во время создания раунда : проблемы с БД!"; break; case 2: $echoAnswer = "Произошла ошибка во время работы с БД!"; break; } } else {
die("Forbidden"); } // header('Content-type: application/json'); if (empty($_GET["action"])) { die(json_encode(array("error" => "IMPLEMENTATION ERROR: No action specified."))); } define("UPLOAD_BANNER_ID", 'uploadBanner'); require_once "lib/constants.php"; require_once "lib/connect.php"; require_once "lib/functions.php"; switch ($_GET["action"]) { case "upload": doUpload(); break; case "newRound": createRound(); break; case "getAlly": getAlly(); break; default: die(json_encode(array("error" => "IMPLEMENTATION ERROR: Action " . $_GET["action"] . " unknown."))); } function doUpload() { // Metadaten zu Banner angegeben? if (empty($_GET["tag"]) || empty($_GET["name"])) { die(json_encode(array("error" => "FORM VALIDATION: Kein Allianzname oder kein Allianztag angegeben."))); } // Datei hochgeladen? if (empty($_FILES[UPLOAD_BANNER_ID])) {