function content() { if (strcmp($_POST['mode'], "Create Deck") == 0) { $deck = insertDeck(); deckProfile($deck); } elseif (strcmp($_POST['mode'], "Update Deck") == 0) { $deck = new Deck($_POST['id']); if ($deck->canEdit($_SESSION['username'])) { $deck = updateDeck($deck); deckProfile($deck); } else { authFailed(); } } elseif (strcmp($_POST['mode'], "Edit Deck") == 0) { $deck = new Deck($_POST['id']); if ($deck->canEdit($_SESSION['username'])) { deckForm($deck); } else { authFailed(); } } elseif (strcmp($_GET['mode'], "create") == 0) { deckForm(); } elseif (strcmp($_GET['mode'], "view") == 0) { if (isset($_GET['event'])) { $event = new Event($_GET['event']); $deck = $event->getPlaceDeck("1st"); } else { $deck = new Deck($_GET['id']); } deckProfile($deck); } }
if (!isset($_POST['event'])) { $_POST['event'] = $_GET['event']; } // part of the reg-decklist feature. both "register" and "addregdeck" switches if (strcmp($_GET['mode'], "register") == 0) { deckRegisterForm(); } else { if (strcmp($_GET['mode'], "addregdeck") == 0) { $deck = insertDeck(); if (count($deck->errors) == 0) { deckProfile($deck); } } else { if (checkDeckAuth($_POST['event'], $deck_player, $deck)) { if (strcmp($_POST['mode'], "Create Deck") == 0) { $deck = insertDeck(); if (count($deck->errors) == 0) { deckProfile($deck); } } elseif (strcmp($_POST['mode'], "Update Deck") == 0) { $deck = updateDeck($deck); if (count($deck->errors) == 0) { deckProfile($deck); } } elseif (strcmp($_POST['mode'], "Edit Deck") == 0) { deckForm($deck); } elseif (strcmp($_GET['mode'], "create") == 0) { deckForm(); } } }