// Defaults $style = ''; $displayErrors = "none"; $errorDisplay = ""; $leagueOptions = new League(); if (isset($_GET['delete']) && $_GET['delete'] == true && isset($_GET['opponentid']) && is_numeric($_GET['opponentid'])) { try { $opponentId = escape($_GET['opponentid']); $leagueOptions->deleteOpponent($opponentId); Session::flash('deleted', 'Opponent Deleted Successfully'); Redirect::to('opponents.php'); } catch (Exception $e) { die($e->getMessage()); } } else { $opponentsResults = $leagueOptions->getOpponents(); } if (Input::exists()) { if (Token::check(Input::get('token'))) { $validate = new Validation(); $validation = $validate->check($_POST, array('OpponentName' => array('name' => 'Opponent', 'min' => 5, 'max' => 50, 'unique' => 'opponent', 'required' => true))); if ($validation->passed()) { try { $leagueOptions->createOpponent(array('OpponentName' => Input::get('OpponentName'))); Session::flash('opponentCreated', 'Opponent created Successfully'); Redirect::to('opponents.php'); } catch (Exception $e) { die($e->getMessage()); } $displayErrors = "none"; } else {