* @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3 * @package SWDB */ require_once(PATH::ACTION . "Action.php"); /** * Deletes a team. * * Reads the POST parameters looking for the following KEYS: * player: the team owner's player id. * id: the team id. * * @category Action */ class Delete_Team_Action extends Action{ /** * Executes the action. * @todo secure */ function execute(){ $player = filter_input(INPUT_POST, 'player'); $id = filter_input(INPUT_POST, 'id'); $statement = get_context()->get_db()->prepare('DELETE FROM team WHERE player = :player AND id = :id;'); $statement->bindValue(':player', $player, SQLITE3_TEXT); $statement->bindValue(':id', $id, SQLITE3_TEXT); $statement->execute(); $statement = get_context()->get_db()->prepare('DELETE FROM team_unit WHERE team = :id;'); $statement->bindValue(':id', $id, SQLITE3_TEXT); $statement->execute(); $this->code = 204; $this->message = "No content."; return; } }