What did you do?!?!?
Error: = $identifierError ?>
isFile()) { while (!$dbConfigFile->eof()) { $line = trim($dbConfigFile->fgets()); if ($line) // check not empty line { $parts = explode(' ', $line); $fullUrl = $parts[1]; $urlParts = explode('/', $fullUrl); $host = $urlParts[0]; $database = $urlParts[1]; $name = $parts[0]; $username = $parts[2]; $password = $parts[3]; $connection = new mysqli($host, $username, $password, $database); if ($connection->connect_error) { die("Connection \"$name\" failed: $connection->connect_error"); } $connections[$name] = $connection; } } } else { die('database-config.dat does not exist or is not a file.'); } /** * @param String $name * @return mysqli */ function getConnection($name) { global $connections; return $connections[$name]; } /** * @param String $filename * @return array JSON data array. */ function toDataArray($filename) { return json_decode(file_get_contents($filename), true); } /** * @param String $identifier * @param array $snapshotData Snapshot data array. * @return Snapshot */ function toSnapshot($identifier, $snapshotData) { $timezone = new DateTimeZone($snapshotData["timezone"]); $players = toPlayers($snapshotData['usernames']); $messages = toMessages($players, $snapshotData['snapshots'], $timezone); $generated = parseDateTime($snapshotData["generated"], $timezone); return new Snapshot($identifier, $messages, $players, $generated); } /** * @param array $reportData * @param Player[] $players * @return Report */ function toReport($reportData, $players) { $id = $reportData["id"]; $serverName = $reportData["serverName"]; $handler = array_key_exists("handler", $reportData) ? getPlayer($players, $reportData["handler"]) : null; $suspect = getPlayer($players, $reportData["suspect"]); $reporters = toReporters($players, $reportData["reporters"]); return new Report($id, $serverName, $handler, $suspect, $reporters); } /** * @param Player[] $players * @param array $messagesData Messages data array. * @param DateTimeZone $timezone * @return Message[] */ function toMessages($players, $messagesData, $timezone) { $messages = array(); for ($i = 0; $i < count($messagesData); $i++) { $messages[$i] = getMessage($players, $messagesData[$i], $timezone); } return $messages; } /** * @param Player[] $players * @param array $messageData Message data array. * @param DateTimeZone $timezone * @return Message */ function getMessage($players, $messageData, $timezone) { $sender = getPlayer($players, $messageData['sender']); $recipients = getPlayersFromUUIDs($players, $messageData['recipients']); $dateTime = parseDateTime($messageData['time'], $timezone); $type = Message::getTypeFromString($messageData['type']); $message = $messageData['message']; return new Message($sender, $recipients, $dateTime, $type, $message); } /** * @param Player[] $players * @param String[] $uuidArray the UUIDs of the players to fetch * @return Player[] */ function getPlayersFromUUIDs($players, $uuidArray) { $matchedPlayers = array(); for ($i = 0; $i < count($uuidArray); $i++) { $matchedPlayers[$i] = getPlayer($players, $uuidArray[$i]); } return $matchedPlayers; } /** * @param Player[] $playersArray * @return Player[] */ function toPlayers($playersArray) // String UUID as Key { $players = array(); foreach ($playersArray as $uuid => $username) { $connection = getConnection("ACCOUNT"); $statement = $connection->prepare("SELECT `rank` FROM `accounts` WHERE `uuid` = ?;"); $statement->bind_param('s', $uuid); $statement->execute(); $statement->bind_result($rank); $statement->fetch(); $statement->close(); $players[$uuid] = new Player($uuid, $username, $rank); } return $players; } /** * @param $playersArray * @param $reportersArray * @return SplObjectStorage */ function toReporters($playersArray, $reportersArray) { $reporters = new SplObjectStorage(); foreach ($reportersArray as $reporterUUID => $reason) { $reporters[getPlayer($playersArray, $reporterUUID)] = $reason; } return $reporters; } /** * @param Player[] $players * @param String $uuid * @return Player */ function getPlayer($players, $uuid) { $player = $players[$uuid]; if ($player != null) { return $player; } else { throw new RuntimeException('Player for UUID not found.'); } } /** * @param String $dateTime * @param DateTimeZone $timezone * @return DateTime */ function parseDateTime($dateTime, $timezone) { return DateTime::createFromFormat(jsonDateTimeFormat, $dateTime, $timezone); } /** /** * Converts an interval to minutes, days or months, depending on the size. * * @param DateInterval $interval * @return string */ function approximateHumanInterval($interval) { if ($interval->m > 0) { $humanString = $interval->m . ' month' . ($interval->m != 0 ? 's' : ''); } else if ($interval->d > 0) { $humanString = $interval->d . ' day' . ($interval->d != 0 ? 's' : ''); } else if ($interval->h > 0) { $humanString = $interval->h . ' hour' . ($interval->h != 0 ? 's' : ''); } else { $humanString = $interval->i . ' minute' . ($interval->i != 0 ? 's' : ''); } return $humanString; } /** * @param String $input * @return String */ function removeBadCharacters($input) { return preg_replace('/[^A-Za-z0-9_\-]/', '_', $input); } $validIdentifier = isset($_GET['identifier']); $identifierError = ""; $identifier = null; $filePath = null; $snapshot = null; $report = null; if ($validIdentifier) { $identifier = removeBadCharacters($_GET['identifier']); // prevents escaping $filePath = dataDir . $identifier . '.json'; if (file_exists($filePath)) { $dataArray = toDataArray($filePath); $snapshot = toSnapshot($identifier, $dataArray); $report = toReport($dataArray['report'], $snapshot->getPlayers()); } else { $validIdentifier = false; $identifierError = "Invalid identifier."; } } ?>
What did you do?!?!?
Error: = $identifierError ?>
= $player->getUUID() ?>