| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /**
- * File for the team deletion action.
- *
- * Implements an action function to be called from the {@see Controller}.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @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;
- }
- }
|