function main() { if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (array_key_exists('content', $_POST)) { // define password bytes $passwordBytes = Configuration::$aesPasswordBytes; // decode $content = $_POST['content']; $decodedContent = base64_decode($content); // decrypt $decryptedContent = EncryptionHelper::decryptMessage($decodedContent, $passwordBytes); $decryptedContent = StringHelper::untilLastOccurence($decryptedContent, '}'); // json decode $highscoreData = json_decode($decryptedContent); // store $config = ConfidentialConfiguration::getDatabaseConfiguration(); $highscore = new Highscore($config->databaseHost, $config->databaseUserName, $config->databaseUserPassword, $config->databaseName); $highscore->insert($highscoreData); die(ResponseHelper::serializeResponse('Success', 'Success')); } else { die(ResponseHelper::serializeResponse('Error', 'The request must contain a POST parameter')); } } else { die(ResponseHelper::serializeResponse('Error', 'Not a POST request, sorry')); } }
function main() { $config = ConfidentialConfiguration::getDatabaseConfiguration(); $highscore = new Highscore($config->databaseHost, $config->databaseUserName, $config->databaseUserPassword, $config->databaseName); $json = $highscore->get(); echo $json; }
function main() { // get highscore json $config = ConfidentialConfiguration::getDatabaseConfiguration(); $highscore = new Highscore($config->databaseHost, $config->databaseUserName, $config->databaseUserPassword, $config->databaseName); $json = $highscore->getRaw(); // unpack $highscoreArray = json_decode($json); // show echo '<b>Last Name - First Name - DisplayName - Email - Score - ConfirmationStatus (0 = not confirmed, 1 = confirmed)</b><br>'; foreach ($highscoreArray as $row) { echo $row->LastName . ' - '; echo $row->FirstName . ' - '; echo $row->DisplayName . ' - '; echo $row->Email . ' - '; echo $row->Score . ' - '; echo $row->ConfirmationStatus; echo '<br>'; } }