/** * get the players for the current game * for the players overview page * * @return array The players */ public function getPlayersOveriew() { $ret['data'] = array(); $ret['pages'] = false; // construct the query with the given options $queryStr = "SELECT SQL_CALC_FOUND_ROWS pdt.*\n\t\t\tFROM `" . DB_PREFIX . "_playerDataTable` as pdt"; $queryStr .= " WHERE pdt.kills >= '" . $this->_DB->real_escape_string($this->_option['minkills']) . "'"; if (isset($this->_option['showToday']) && $this->_option['showToday'] === "1") { // should we show only players from today $startDay = time() - 86400; $startDay = date("Y-m-d H:i:s", $startDay); $queryStr .= " AND pdt.lastConnect > '" . $startDay . "'"; } $queryStr .= " ORDER BY "; if (!empty($this->_option['sort']) && !empty($this->_option['sortorder'])) { $queryStr .= " " . $this->_option['sort'] . " " . $this->_option['sortorder'] . ""; } //$queryStr .=" ,t1.lastName ASC"; // calculate the limit if ($this->_option['page'] === 1) { $queryStr .= " LIMIT 0," . $this->_entriesPerPage; } else { $start = $this->_entriesPerPage * ($this->_option['page'] - 1); $queryStr .= " LIMIT " . $start . "," . $this->_entriesPerPage; } $query = $this->_DB->query($queryStr); if (SHOW_DEBUG && $this->_DB->error) { var_dump($this->_DB->error); } if ($query->num_rows > 0) { while ($result = $query->fetch_assoc()) { #$result['name'] = makeSavePlayerName($result['name']); $result['steamProfile'] = getSteamProfileUrl($result['uniqueID']); $pl[$result['uniqueID']] = $result; } $ret['data'] = $pl; } // get the max count for pagination $query = $this->_DB->query("SELECT FOUND_ROWS() AS 'rows'"); $result = $query->fetch_assoc(); $ret['pages'] = (int) ceil($result['rows'] / $this->_entriesPerPage); return $ret; }
/** * get the player uniqueids if any * * @return void */ private function _getUniqueIds() { $this->_playerData['uniqueIds'] = '-'; $query = $this->_DB->query("SELECT uniqueId\n\t\t\t\t\t\tFROM `" . DB_PREFIX . "_PlayerUniqueIds`\n\t\t\t\t\t\tWHERE playerId = '" . $this->_DB->real_escape_string($this->playerId) . "'"); if (SHOW_DEBUG && $this->_DB->error != '') { var_dump($this->_DB->error); } if ($query->num_rows > 0) { $ret = ''; while ($result = $query->fetch_assoc()) { if (strstr($result['uniqueId'], 'STEAM_')) { $ret = getSteamProfileUrl($result['uniqueId']); $this->_getSteamStats($result['uniqueId']); break; } $ret .= $result['uniqueId'] . ",<br />"; } $this->_playerData['uniqueIds'] = $ret; $query->free(); } }
/** * get the player uniqueids if any * * @return void */ private function _getUniqueIds() { $this->_playerData['uniqueIds'] = '-'; $query = mysql_query("SELECT uniqueId\n\t\t\t\t\t\tFROM " . DB_PREFIX . "_PlayerUniqueIds\n\t\t\t\t\t\tWHERE playerId='" . mysql_escape_string($this->playerId) . "'"); if (mysql_num_rows($query) > 0) { while ($result = mysql_fetch_assoc($query)) { if (strstr($result['uniqueId'], 'STEAM_')) { $result['uniqueId'] = getSteamProfileUrl($result['uniqueId']); } $ret = $result['uniqueId'] . ", "; } $this->_playerData['uniqueIds'] = trim($ret, ', '); mysql_free_result($query); } }