| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- /**
- * File for the team score modification.
- *
- * Implements an action function to be called from the {@see Controller}.
- *
- * @category Action
- */
- /**
- * Sets the score for a team.
- *
- * Reads the POST parameters looking for the following KEYS:
- * uid
- * team
- * score
- * Validates the data and sets the score.
- *
- * @return int 0 on success, negative values on error.
- * @category Action
- * @global resource Database connection.
- */
- function action(){
- global $db;
- $player = filter_input(INPUT_GET, "uid");
- $mode = filter_input(INPUT_GET, "mode");
- if (mode != GAME_MODE_ID::NORMAL && mode != GAME_MODE_ID::RTA){
- return 400;
- }
- $statement = $db->prepare("
- UPDATE player
- SET mode = :mode
- WHERE uid = :uid;
- ");
- $statement->bindValue(":mode", $mode, SQLITE3_TEXT);
- $statement->bindValue(":uid", $player, SQLITE3_TEXT);
- $statement->execute();
- header("HTTP/1.1 201 OK");
- die();
- return 201;
- }
- ?>
|