- Added basic display for results, needs work
- Added new tool to tools.js used to checking if a page is loaded in a frame or by itself - Removed old division-based .html displays, no longer relevant
This commit is contained in:
parent
b6c2f08731
commit
b2d27837ac
120
display/general_results.php
Normal file
120
display/general_results.php
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
||||||
|
<link rel="stylesheet" href="/styles/primary.css" />
|
||||||
|
<link rel="stylesheet" href="/styles/data.css" />
|
||||||
|
<link rel="stylesheet" href="/styles/data_display.css" />
|
||||||
|
<script src="/scripts/tools.js"></script>
|
||||||
|
<script>verifyPageInFrame()</script>
|
||||||
|
<title>GENERAL DATA</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
include("../admin/db_config.php");
|
||||||
|
|
||||||
|
try { // Try opening the SQL database connection
|
||||||
|
$conn = new PDO("mysql:host=$servername; dbname=$dbName", $dbUsername, $dbPassword);
|
||||||
|
// set the PDO error mode to exception
|
||||||
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
// Grab all our tourney and game results
|
||||||
|
// Prepare SQL
|
||||||
|
$sqlGetTourneyData = $conn->prepare("SELECT * FROM " . $tournamentDataTableName);
|
||||||
|
$sqlGetGameData = $conn->prepare("SELECT * FROM " . $gameDataTableName);
|
||||||
|
$sqlGetUserData = $conn->prepare("SELECT username FROM " . $userTableName);
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
$sqlGetTourneyData->execute();
|
||||||
|
$sqlGetGameData->execute();
|
||||||
|
$sqlGetUserData->execute();
|
||||||
|
|
||||||
|
// fetch rows
|
||||||
|
$tourneyData = $sqlGetTourneyData->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$gameData = $sqlGetGameData->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$userData = $sqlGetUserData->fetchAll(PDO::FETCH_NUM);
|
||||||
|
|
||||||
|
// Initalize arrays to store tournament winner counts
|
||||||
|
// Total count
|
||||||
|
$totalTourneyWinners = array();
|
||||||
|
$openTourneyWinners = array();
|
||||||
|
$intermediateTourneyWinners = array();
|
||||||
|
$mainTourneyWinners = array();
|
||||||
|
|
||||||
|
// Check the number of players for each entry
|
||||||
|
// Then, grab that many winners
|
||||||
|
foreach ($tourneyData as $data) {
|
||||||
|
for ($i = 1; $i <= $data["numPlayers"]; $i++) {
|
||||||
|
$winnerIndex = "winner" . $i;
|
||||||
|
$totalTourneyWinners[] = $data[$winnerIndex];
|
||||||
|
if ($data["tournamentDivision"] == "open") {
|
||||||
|
$openTourneyWinners[] = $data[$winnerIndex];
|
||||||
|
}
|
||||||
|
if ($data["tournamentDivision"] == "intermediate") {
|
||||||
|
$intermediateTourneyWinners[] = $data[$winnerIndex];
|
||||||
|
}
|
||||||
|
if ($data["tournamentDivision"] == "main") {
|
||||||
|
$mainTourneyWinners[] = $data[$winnerIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make 'unique' arrays, so we have TOTAL # played vs. # won
|
||||||
|
$totalUniqueTourneyWinners = array_unique($totalTourneyWinners);
|
||||||
|
$openUniqueTourneyWinners = array_unique($openTourneyWinners);
|
||||||
|
$intermediateUniqueTourneyWinners = array_unique($intermediateTourneyWinners);
|
||||||
|
$mainUniqueTourneyWinners = array_unique($mainTourneyWinners);
|
||||||
|
|
||||||
|
|
||||||
|
// Get counts of rows
|
||||||
|
$numGames = count($gameData);
|
||||||
|
$numTourneys = count($tourneyData);
|
||||||
|
$numUsers = count($userData);
|
||||||
|
$numTotalTourneyWinners = count($totalTourneyWinners);
|
||||||
|
$numOpenTourneyWinners = count($openTourneyWinners);
|
||||||
|
$numIntermediateTourneyWinners = count($intermediateTourneyWinners);
|
||||||
|
$numMainTourneyWinners = count($mainTourneyWinners);
|
||||||
|
$numUniqueTotalTourneyWinners = count($totalUniqueTourneyWinners);
|
||||||
|
$numUniqueOpenTourneyWinners = count($openUniqueTourneyWinners);
|
||||||
|
$numUniqueIntermediateTourneyWinners = count($intermediateUniqueTourneyWinners);
|
||||||
|
$numUniqueMainTourneyWinners = count($mainUniqueTourneyWinners);
|
||||||
|
|
||||||
|
// Other data
|
||||||
|
$userIndex = $numUsers - 1;
|
||||||
|
$mostRecentUser = $userData[$userIndex][0];
|
||||||
|
|
||||||
|
|
||||||
|
} catch (PDOException $e) { // failed connection
|
||||||
|
echo "Connection failed: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<body id="resultsDisplayBody">
|
||||||
|
<h2>General Information</h2>
|
||||||
|
<div id="generalResultsDisplayPanel">
|
||||||
|
<?php
|
||||||
|
echo "<p>Total registered users: $numUsers</p>";
|
||||||
|
echo "<p>Most recent user: $mostRecentUser</p>";
|
||||||
|
echo "<p>Number of Official Tournaments: $numTourneys</p>";
|
||||||
|
echo "<p>Number of game results uploaded: $numGames</p>";
|
||||||
|
echo "<p>Total # of titles won: $numTotalTourneyWinners</p>";
|
||||||
|
echo "<p># of winners: $numUniqueTotalTourneyWinners</p>";
|
||||||
|
echo "<p>Total 'Open' titles won: $numOpenTourneyWinners</p>";
|
||||||
|
echo "<p># of winners: $numUniqueOpenTourneyWinners</p>";
|
||||||
|
echo "<p>Total 'Intermediate' titles won: $numIntermediateTourneyWinners</p>";
|
||||||
|
echo "<p># of winners: $numUniqueIntermediateTourneyWinners</p>";
|
||||||
|
echo "<p>Total 'Main' of titles won: $numMainTourneyWinners</p>";
|
||||||
|
echo "<p># of winners: $numUniqueMainTourneyWinners</p>";
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
|
||||||
|
</html>
|
12
index.php
12
index.php
@ -16,16 +16,7 @@ session_start();
|
|||||||
<div id="contentFrame">
|
<div id="contentFrame">
|
||||||
<h1>Trojan's Trophy Room</h1>
|
<h1>Trojan's Trophy Room</h1>
|
||||||
<h4><a href="/giveaway" id="giveawayLink">Giveaway Disclaimer</a></h4>
|
<h4><a href="/giveaway" id="giveawayLink">Giveaway Disclaimer</a></h4>
|
||||||
<h3>Choose a division to see results!</h3>
|
<iframe src="/display/general_results.php" name="dataFrame" class="dataFrame" id="dataFrame" onload="resizeIframe(this);"></iframe>
|
||||||
<div class="navPanel">
|
|
||||||
<a href="/open.html" target="dataFrame" class="navLink">OPEN</a>
|
|
||||||
<a href="/intermediate.html" target="dataFrame" class="navLink">INTERMEDIATE</a>
|
|
||||||
<a href="/main.html" target="dataFrame" class="navLink">MAIN</a>
|
|
||||||
<p class="newLine"></p>
|
|
||||||
<a href="/general.html" target="dataFrame" class="navLink">GENERAL (HOME)</a>
|
|
||||||
</div>
|
|
||||||
<p> </p>
|
|
||||||
<iframe src="/open.html" name="dataFrame" class="dataFrame" id="dataFrame" onload="resizeIframe(this);"></iframe>
|
|
||||||
<p class="newLine"></p>
|
<p class="newLine"></p>
|
||||||
<p class="newLine"></p>
|
<p class="newLine"></p>
|
||||||
<div class="subNav">
|
<div class="subNav">
|
||||||
@ -33,6 +24,7 @@ session_start();
|
|||||||
// Is the user is logged in we'll show them a navigation bar with some fancier options
|
// Is the user is logged in we'll show them a navigation bar with some fancier options
|
||||||
if (isset($_SESSION["userID"])){
|
if (isset($_SESSION["userID"])){
|
||||||
echo "<a href=\"/user/" . $_SESSION["username"] . " \" class=\"subNavLink\">ACCOUNT</a>";
|
echo "<a href=\"/user/" . $_SESSION["username"] . " \" class=\"subNavLink\">ACCOUNT</a>";
|
||||||
|
echo "<a href=\"/ \" class=\"subNavLink\">HOME</a>";
|
||||||
echo "<a href=\"/logout.php \" class=\"subNavLink\">LOGOUT</a>";
|
echo "<a href=\"/logout.php \" class=\"subNavLink\">LOGOUT</a>";
|
||||||
echo "<a href=\"/admin/data_management/game_form.php \" target=\"dataFrame\" class=\"subNavLink\">ADD GAME DETAILS</a>";
|
echo "<a href=\"/admin/data_management/game_form.php \" target=\"dataFrame\" class=\"subNavLink\">ADD GAME DETAILS</a>";
|
||||||
// Anything we need to show to logged in admins will be below
|
// Anything we need to show to logged in admins will be below
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
|
||||||
<link rel="stylesheet" href="/styles/primary.css" />
|
|
||||||
<link rel="stylesheet" href="/styles/data.css" />
|
|
||||||
<title>INTERMEDIATE DIVISION DATA</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body id="leaderBody">
|
|
||||||
<div id="informationContentPanel">
|
|
||||||
<h4>INTERMEDIATE DIVISION</h4>
|
|
||||||
<h5>Max rank: Champ 3</h5>
|
|
||||||
<table id="informationTable">
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">TrojanDestinyRL</td>
|
|
||||||
<td class="infoTableRightColumn">3</td>
|
|
||||||
<td><img src="assets/trophy_intermediate.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">Endeavor</td>
|
|
||||||
<td class="infoTableRightColumn">2</td>
|
|
||||||
<td><img src="assets/trophy_intermediate.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">KingKuna</td>
|
|
||||||
<td class="infoTableRightColumn">2</td>
|
|
||||||
<td><img src="assets/trophy_intermediate.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">vixify</td>
|
|
||||||
<td class="infoTableRightColumn">2</td>
|
|
||||||
<td><img src="assets/trophy_intermediate.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">Aura</td>
|
|
||||||
<td class="infoTableRightColumn">1</td>
|
|
||||||
<td><img src="assets/trophy_intermediate.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">imKryss</td>
|
|
||||||
<td class="infoTableRightColumn">1</td>
|
|
||||||
<td><img src="assets/trophy_intermediate.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">Priickles</td>
|
|
||||||
<td class="infoTableRightColumn">1</td>
|
|
||||||
<td><img src="assets/trophy_intermediate.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">toxic_deadpool_x</td>
|
|
||||||
<td class="infoTableRightColumn">1</td>
|
|
||||||
<td><img src="assets/trophy_intermediate.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">Vix</td>
|
|
||||||
<td class="infoTableRightColumn">1</td>
|
|
||||||
<td><img src="assets/trophy_intermediate.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
45
main.html
45
main.html
@ -1,45 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
|
||||||
<link rel="stylesheet" href="/styles/primary.css" />
|
|
||||||
<link rel="stylesheet" href="/styles/data.css" />
|
|
||||||
<title>MAIN DIVISION DATA</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body id="leaderBody">
|
|
||||||
<div id="informationContentPanel">
|
|
||||||
<h4>MAIN DIVISION</h4>
|
|
||||||
<h5>Max rank: SSL</h5>
|
|
||||||
<table id="informationTable">
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">RU33ER DUCK7</td>
|
|
||||||
<td class="infoTableRightColumn">3</td>
|
|
||||||
<td><img src="assets/trophy_main.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">Aura</td>
|
|
||||||
<td class="infoTableRightColumn">1</td>
|
|
||||||
<td><img src="assets/trophy_main.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">Seqsons</td>
|
|
||||||
<td class="infoTableRightColumn">1</td>
|
|
||||||
<td><img src="assets/trophy_main.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">Stewy</td>
|
|
||||||
<td class="infoTableRightColumn">1</td>
|
|
||||||
<td><img src="assets/trophy_main.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">Trash</td>
|
|
||||||
<td class="infoTableRightColumn">1</td>
|
|
||||||
<td><img src="assets/trophy_main.png" height="25"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
32
open.html
32
open.html
@ -1,32 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
|
||||||
<link rel="stylesheet" href="/styles/primary.css" />
|
|
||||||
<link rel="stylesheet" href="/styles/data.css" />
|
|
||||||
<title>OPEN DIVISION DATA</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body id="leaderBody">
|
|
||||||
<div id="informationContentPanel">
|
|
||||||
<h4>OPEN DIVISION</h4>
|
|
||||||
<h5>Max rank: Plat 3</h5>
|
|
||||||
<table id="informationTable">
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">No Data</td>
|
|
||||||
<td class="infoTableRightColumn">No Data</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">No Data</td>
|
|
||||||
<td class="infoTableRightColumn">No Data</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="infoTableLeftColumn">No Data</td>
|
|
||||||
<td class="infoTableRightColumn">No Data</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -6,8 +6,21 @@ function resizeIframe(obj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getURL(path) {
|
function getURL(path) {
|
||||||
|
// Gets the URL so we can re-direct the user back to where they came from
|
||||||
if (path == undefined) {
|
if (path == undefined) {
|
||||||
path = "";
|
path = "";
|
||||||
}
|
}
|
||||||
return window.location.href + path;
|
return window.location.href + path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function verifyPageInFrame() {
|
||||||
|
// Verify that the page was loaded in an iFrame
|
||||||
|
// Otherwise back to the homepage they go!
|
||||||
|
var mainURL = window.location.origin;
|
||||||
|
console.log(mainURL);
|
||||||
|
|
||||||
|
if (window.self !== window.top) {
|
||||||
|
} else {
|
||||||
|
window.location = mainURL;
|
||||||
|
}
|
||||||
|
}
|
7
styles/data_display.css
Normal file
7
styles/data_display.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#resultsDisplayBody {
|
||||||
|
width:800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#generalResultsDisplayPanel {
|
||||||
|
width: 400px;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user