コード例 #1
0
ファイル: Scoreboard.php プロジェクト: pcoss3413/TechnoTap
        $tmp = array($r["username"], $r["country"], $r["score"]);
        if ($includeId) {
            array_push($tmp, $r["id"]);
        }
        array_push($result, $tmp);
    }
    return $result;
}
if ($_POST["data"]) {
    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));
            }
コード例 #2
0
ファイル: index.php プロジェクト: pcoss3413/TechnoTap
<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!
            echo '<td><span style="color:red">Game Maker</span></td>';