| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?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");
- $team = filter_input(INPUT_GET, "team");
- $score = intval(filter_input(INPUT_GET, "score"));
- $statement = $db->prepare("
- UPDATE team
- SET score = :score
- WHERE
- uid = :uid AND
- id = :team;
- ");
- $statement->bindValue(":score", $score, SQLITE3_TEXT);
- $statement->bindValue(":uid", $player, SQLITE3_TEXT);
- $statement->bindValue(":team", $team, SQLITE3_TEXT);
- $statement->execute();
- return 0;
- }
- ?>
|