コード例 #1
0
ファイル: common.inc.php プロジェクト: russx2/tap-trap
/**
 * Updates the players name associated with the passed uuid.
 * 
 * @param playerUUID  The UUID of the player to update
 * @param playerName  The new name for the player
 * @return 			  True on success, false on failure
 */
function setPlayerName($playerUUID, $playerName)
{
    // do the update based on the internal ID, rather than the public UUID
    $playerID = getPlayerFromUUID($playerUUID);
    $qryUpdate = 'UPDATE
					  players
					  SET
					  name = \'' . dbEscape($playerName) . '\'
					  WHERE
					  id = \'' . (int) dbEscape($playerID) . '\'';
    $resUpdate = mysql_query($qryUpdate);
    return $resUpdate ? true : false;
}
コード例 #2
0
ファイル: scores.php プロジェクト: russx2/tap-trap
<?php

require_once '../config.inc.php';
require_once DIR_INCLUDE . '/common.inc.php';
// make sure the scores aren't cached
sendXMLHeaders();
// initially see whether this is an existing player
$playerUUID = getRequest('puuid');
$playerID = getPlayerFromUUID($playerUUID);
//
// At this point, $playerUUID may be false (if one wasn't passed). We can safely ignore
// this as the queries involving a specific player will all return nothing which is
// fine.
//
//
// retrieve top player scores
//
$qryPlayer = 'SELECT
				  score
				  FROM
				  scores
				  WHERE
				  player_id = \'' . (int) $playerID . '\' 
				  ORDER BY
				  score DESC
				  LIMIT ' . MAX_PLAYER_SCORES;
$resPlayer = mysql_query($qryPlayer);
// extract player scores
$scorePlayers = array();
for ($i = 0; $i < MAX_PLAYER_SCORES; $i++) {
    $row = mysql_fetch_assoc($resPlayer);