Example #1
0
    header('Content-Type: application/json');
    $info = explode("|", decrypt($_POST["data"]));
    if (sizeof($info) > 2) {
        //We probably don't need these mysql escapes here, since these requests are encrypted, but just in case
        //a hacker does crack the AES, the worst they will be able to do is insert a fake score
        $scoreId = $scoreboard->addScore(mysql_escape_string($info[0]), mysql_escape_string($info[1]), mysql_escape_string($info[2]));
        $recent = $scoreboard->getRecentScores();
        echo json_encode(array('scoreId' => $scoreId, 'recent' => formatForiOS($recent, true), 'success' => 1));
    } else {
        echo json_encode(array('message' => 'Submission failed. Please try again.', 'success' => 0));
    }
} else {
    if ($_POST["action"]) {
        header('Content-Type: application/json');
        if ($_POST["action"] == "getTop100") {
            echo json_encode(array('scores' => formatForiOS($scoreboard->getTop100Scores(), false), 'success' => 1));
        } else {
            if ($_POST["action"] == "getMostRecent") {
                echo json_encode(array('scores' => formatForiOS($scoreboard->getRecentScores(), true), 'success' => 1));
            } else {
                echo json_encode(array('message' => 'Invalid Request', 'success' => 0));
            }
        }
    } else {
        //Do testing stuff here!
        //$scoreboard->deleteAll();
        $d = 0;
        $top100 = $scoreboard->getTop100Scores();
        $recent = $scoreboard->getRecentScores();
        $rank = 1;
        echo '<center><br /><table border=1 width= 300 style="float:left">';
Example #2
0
</p</div><br />
<center><p>Copyright &copy; 2015 Patrick Cossette</p></center>
		<?php 
            $pageFound = true;
        }
    }
}
if (!$pageFound) {
    include 'scoredb.php';
    $scoreboard = new scoreboarddb();
    echo '<br />';
    echo '<a href="/TechnoTap/?page=privacy">Privacy Policy</a>';
    echo '&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:white;">|</span>&nbsp;&nbsp;&nbsp;&nbsp;';
    echo '<a href="/TechnoTap/?page=about">About</a><br /><br />';
    echo "<h2>-Scoreboard-</h2></p><br /><br />";
    $top100 = $scoreboard->getTop100Scores();
    $recent = $scoreboard->getRecentScores();
    $rank = 1;
    echo '<div class="tableContainer"><br /><table border=1 width= 300 style="float:left">';
    echo '<tr><td colspan="4"><h3><center>Top 100</center></h3></td></tr>';
    echo '<tr>';
    echo '<td><b>Rank</b></td>';
    echo '<td><b>Name</b></td>';
    echo '<td><b>Score</b></td>';
    echo '<td><b>Country</b></td>';
    echo '</tr>';
    foreach ($top100 as $score) {
        echo '<tr>';
        echo '<td><b>' . $rank . '</b></td>';
        if (!strcmp($score['username'], "*game_maker*")) {
            //Because I'm vain!