THE BIG "I need to commit more" UPDATE!
- Can now create users - Can now create tournaments - Has (temporary) link to giveaway - Removed dev_db_config that was added by mistake (the db pw has been changed!) - Tons of other little changes
This commit is contained in:
parent
1364e665bc
commit
4dd3604d81
@ -4,6 +4,7 @@
|
||||
<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/admin.css" />
|
||||
<link rel="stylesheet" href="../styles/admin_nav.css" />
|
||||
<!-- <script src="trojan.js"></script>-->
|
||||
@ -20,10 +21,10 @@
|
||||
<a href="user_management/create_safe_admin.php" target="dataFrame" class="navLink">CREATE SAFE ADMIN</a>
|
||||
</div>
|
||||
<p> </p>
|
||||
<h3>TOURNEY MANAGEMENT</h3>
|
||||
<h3>DATA MANAGEMENT</h3>
|
||||
<div class="navPanel" id="tourneyManagementPanel">
|
||||
<a href="#" target="dataFrame" class="navLink">ADD VICTORY</a>
|
||||
<a href="#" target="dataFrame" class="navLink">TWO</a>
|
||||
<a href="data_management/game_form.php" target="dataFrame" class="navLink">ADD GAME</a>
|
||||
<a href="data_management/tourney_form.php" target="dataFrame" class="navLink">CREATE TOURNAMENT</a>
|
||||
<a href="#" target="dataFrame" class="navLink">THREE</a>
|
||||
</div>
|
||||
<p> </p>
|
||||
@ -31,7 +32,7 @@
|
||||
<div class="navPanel" id="dbManagementPanel">
|
||||
<a href="db_management/conn_check.php" target="dataFrame" class="navLink">CHECK DB CONNECTION</a>
|
||||
<a href="db_management/reinitialize.php" target="dataFrame" class="navLink">RE-INITIALIZE DB</a>
|
||||
<a href="#" target="dataFrame" class="navLink">SHOW RAW DB</a>
|
||||
<a href="#" target="dataFrame" class="navLink" >SHOW RAW DB</a>
|
||||
</div>
|
||||
<p> </p>
|
||||
</div>
|
||||
|
189
admin/data_management/add_game.php
Normal file
189
admin/data_management/add_game.php
Normal file
@ -0,0 +1,189 @@
|
||||
<?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="../db_management/db_management.css" />
|
||||
<title>no title</title>
|
||||
</head>
|
||||
|
||||
<body class="sqlOutput">
|
||||
<?php
|
||||
// USER-DEFINED VARIABLES
|
||||
include("../db_config.php"); // Include database stuff
|
||||
|
||||
|
||||
try { // Try opening the SQL database connection
|
||||
$conn = new PDO("mysql:host=$servername; dbname=$dbName", $username, $password);
|
||||
// set the PDO error mode to exception
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
echo "<p>Connected successfully</p>";
|
||||
|
||||
|
||||
// Need to check if values were sent over POST, otherwise set to N/A
|
||||
if (isset($_POST["bluePlayer1"])) {
|
||||
$bluePlayer1 = $_POST["bluePlayer1"];
|
||||
} else {
|
||||
$bluePlayer1 = "N/A";
|
||||
}
|
||||
if (isset($_POST["bluePlayer2"])) {
|
||||
$bluePlayer2 = $_POST["bluePlayer2"];
|
||||
} else {
|
||||
$bluePlayer2 = "N/A";
|
||||
}
|
||||
if (isset($_POST["bluePlayer3"])) {
|
||||
$bluePlayer3 = $_POST["bluePlayer3"];
|
||||
} else {
|
||||
$bluePlayer3 = "N/A";
|
||||
}
|
||||
if (isset($_POST["bluePlayer4"])) {
|
||||
$bluePlayer4 = $_POST["bluePlayer4"];
|
||||
} else {
|
||||
$bluePlayer4 = "N/A";
|
||||
}
|
||||
if (isset($_POST["orangePlayer1"])) {
|
||||
$orangePlayer1 = $_POST["orangePlayer1"];
|
||||
} else {
|
||||
$orangePlayer1 = "N/A";
|
||||
}
|
||||
|
||||
if (isset($_POST["orangePlayer2"])) {
|
||||
$orangePlayer2 = $_POST["orangePlayer2"];
|
||||
} else {
|
||||
$orangePlayer2 = "N/A";
|
||||
}
|
||||
|
||||
if (isset($_POST["orangePlayer3"])) {
|
||||
$orangePlayer3 = $_POST["orangePlayer3"];
|
||||
} else {
|
||||
$orangePlayer3 = "N/A";
|
||||
}
|
||||
|
||||
if (isset($_POST["orangePlayer4"])) {
|
||||
$orangePlayer4 = $_POST["orangePlayer4"];
|
||||
} else {
|
||||
$orangePlayer4 = "N/A";
|
||||
}
|
||||
|
||||
$gameName = $_POST["gameName"];
|
||||
$gameDate = $_POST["gameDate"];
|
||||
$numPlayers = $_POST["numPlayers"];
|
||||
$blueScore = $_POST["blueScore"];
|
||||
$blueTeamName = $_POST["blueTeamName"];
|
||||
$orangeScore = $_POST["orangeScore"];
|
||||
$orangeTeamName = $_POST["orangeTeamName"];
|
||||
/*
|
||||
$bluePlayer1 = $_POST["bluePlayer1"];
|
||||
$bluePlayer2 = $_POST["bluePlayer2"];
|
||||
$bluePlayer3 = $_POST["bluePlayer3"];
|
||||
$bluePlayer4 = $_POST["bluePlayer4"];
|
||||
$orangePlayer1 = $_POST["orangePlayer1"];
|
||||
$orangePlayer2 = $_POST["orangePlayer2"];
|
||||
$orangePlayer3 = $_POST["orangePlayer3"];
|
||||
$orangePlayer4 = $_POST["orangePlayer4"];
|
||||
*/
|
||||
$tourneyName = $_POST["tourneyName"];
|
||||
$ballchasingID = $_POST["ballchasingID"];
|
||||
$notes = $_POST["notes"];
|
||||
|
||||
$uploadedBy = $_SESSION["username"];
|
||||
$uploadedByID = $_SESSION["userID"];
|
||||
|
||||
if ($blueScore > $orangeScore) {
|
||||
$winningTeam = "blue";
|
||||
} elseif ($blueScore < $orangeScore) {
|
||||
$winningTeam = "orange";
|
||||
} else {
|
||||
$winningTeam = $_POST["winners"];
|
||||
}
|
||||
|
||||
|
||||
$insert = $conn->prepare("INSERT INTO " . $gameDataTableName . " (
|
||||
gameName,
|
||||
gameDate,
|
||||
uploadedBy,
|
||||
uploadedByID,
|
||||
numPlayers,
|
||||
winningTeam,
|
||||
blueScore,
|
||||
blueTeamName,
|
||||
orangeScore,
|
||||
orangeTeamName,
|
||||
bluePlayer1,
|
||||
bluePlayer2,
|
||||
bluePlayer3,
|
||||
bluePlayer4,
|
||||
orangePlayer1,
|
||||
orangePlayer2,
|
||||
orangePlayer3,
|
||||
orangePlayer4,
|
||||
tournamentName,
|
||||
ballchasingID,
|
||||
notes
|
||||
) VALUES (
|
||||
:gameName,
|
||||
:gameDate,
|
||||
:uploadedBy,
|
||||
:uploadedByID,
|
||||
:numPlayers,
|
||||
:winningTeam,
|
||||
:blueScore,
|
||||
:blueTeamName,
|
||||
:orangeScore,
|
||||
:orangeTeamName,
|
||||
:bluePlayer1,
|
||||
:bluePlayer2,
|
||||
:bluePlayer3,
|
||||
:bluePlayer4,
|
||||
:orangePlayer1,
|
||||
:orangePlayer2,
|
||||
:orangePlayer3,
|
||||
:orangePlayer4,
|
||||
:tournamentName,
|
||||
:ballchasingID,
|
||||
:notes
|
||||
)");
|
||||
|
||||
|
||||
$insert->bindValue(":gameName", $gameName);
|
||||
$insert->bindValue(":gameDate", $gameDate);
|
||||
$insert->bindValue(":uploadedBy", $uploadedBy);
|
||||
$insert->bindValue(":uploadedByID", $uploadedByID);
|
||||
$insert->bindValue(":numPlayers", $numPlayers);
|
||||
$insert->bindValue(":winningTeam", $winningTeam);
|
||||
$insert->bindValue(":blueScore", $blueScore);
|
||||
$insert->bindValue(":blueTeamName", $blueTeamName);
|
||||
$insert->bindValue(":orangeScore", $orangeScore);
|
||||
$insert->bindValue(":orangeTeamName", $orangeTeamName);
|
||||
$insert->bindValue(":bluePlayer1", $bluePlayer1);
|
||||
$insert->bindValue(":bluePlayer2", $bluePlayer2);
|
||||
$insert->bindValue(":bluePlayer3", $bluePlayer3);
|
||||
$insert->bindValue(":bluePlayer4", $bluePlayer4);
|
||||
$insert->bindValue(":orangePlayer1", $orangePlayer1);
|
||||
$insert->bindValue(":orangePlayer2", $orangePlayer2);
|
||||
$insert->bindValue(":orangePlayer3", $orangePlayer3);
|
||||
$insert->bindValue(":orangePlayer4", $orangePlayer4);
|
||||
$insert->bindValue(":tournamentName", $tourneyName);
|
||||
$insert->bindValue(":ballchasingID", $ballchasingID);
|
||||
$insert->bindValue(":notes", $notes);
|
||||
|
||||
|
||||
|
||||
$insert->execute();
|
||||
|
||||
echo "Successfully uploaded new game record";
|
||||
|
||||
} catch (PDOException $e) { // failed connection
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
$conn = null;
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
123
admin/data_management/add_tourney.php
Normal file
123
admin/data_management/add_tourney.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?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="../db_management/db_management.css" />
|
||||
<title>no title</title>
|
||||
</head>
|
||||
|
||||
<body class="sqlOutput">
|
||||
<?php
|
||||
// USER-DEFINED VARIABLES
|
||||
include("../db_config.php"); // Include database stuff
|
||||
|
||||
|
||||
try { // Try opening the SQL database connection
|
||||
$conn = new PDO("mysql:host=$servername; dbname=$dbName", $username, $password);
|
||||
// set the PDO error mode to exception
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
|
||||
// Need to check if values were sent over POST, otherwise set to N/A
|
||||
if (isset($_POST["winningPlayer1"])) {
|
||||
$winningPlayer1 = $_POST["winningPlayer1"];
|
||||
} else {
|
||||
$winningPlayer1 = "N/A";
|
||||
}
|
||||
if (isset($_POST["winningPlayer2"])) {
|
||||
$winningPlayer2 = $_POST["winningPlayer2"];
|
||||
} else {
|
||||
$winningPlayer2 = "N/A";
|
||||
}
|
||||
if (isset($_POST["winningPlayer3"])) {
|
||||
$winningPlayer3 = $_POST["winningPlayer3"];
|
||||
} else {
|
||||
$winningPlayer3 = "N/A";
|
||||
}
|
||||
if (isset($_POST["winningPlayer4"])) {
|
||||
$winningPlayer4 = $_POST["winningPlayer4"];
|
||||
} else {
|
||||
$winningPlayer4 = "N/A";
|
||||
}
|
||||
|
||||
$tourneyName = $_POST["tourneyName"];
|
||||
$tourneyDate = $_POST["tourneyDate"];
|
||||
$division = $_POST["division"];
|
||||
$numPlayers = $_POST["numPlayers"];
|
||||
$bestOf = $_POST["bestOf"];
|
||||
$winningTeamName = $_POST["winningTeamName"];
|
||||
$notes = $_POST["notes"];
|
||||
|
||||
echo "<p>$tourneyName</p>";
|
||||
echo "<p>$tourneyDate</p>";
|
||||
echo "<p>$division</p>";
|
||||
echo "<p>$numPlayers</p>";
|
||||
echo "<p>$bestOf</p>";
|
||||
echo "<p>$winningTeamName</p>";
|
||||
echo "<p>$winningPlayer1</p>";
|
||||
echo "<p>$winningPlayer2</p>";
|
||||
echo "<p>$winningPlayer3</p>";
|
||||
echo "<p>$winningPlayer4</p>";
|
||||
echo "<p>$notes</p>";
|
||||
|
||||
|
||||
$insert = $conn->prepare("INSERT INTO " . $tournamentDataTableName . " (
|
||||
tournamentName,
|
||||
tournamentDate,
|
||||
tournamentDivision,
|
||||
numPlayers,
|
||||
bestOf,
|
||||
winningTeamName,
|
||||
winner1,
|
||||
winner2,
|
||||
winner3,
|
||||
winner4,
|
||||
notes
|
||||
) VALUES (
|
||||
:tournamentName,
|
||||
:tournamentDate,
|
||||
:tournamentDivision,
|
||||
:numPlayers,
|
||||
:bestOf,
|
||||
:winningTeamName,
|
||||
:winner1,
|
||||
:winner2,
|
||||
:winner3,
|
||||
:winner4,
|
||||
:notes
|
||||
)");
|
||||
|
||||
|
||||
$insert->bindValue(":tournamentName", $tourneyName);
|
||||
$insert->bindValue(":tournamentDate", $tourneyDate);
|
||||
$insert->bindValue(":tournamentDivision", $division);
|
||||
$insert->bindValue(":numPlayers", $numPlayers);
|
||||
$insert->bindValue(":bestOf", $bestOf);
|
||||
$insert->bindValue(":winningTeamName", $winningTeamName);
|
||||
$insert->bindValue(":winner1", $winningPlayer1);
|
||||
$insert->bindValue(":winner2", $winningPlayer2);
|
||||
$insert->bindValue(":winner3", $winningPlayer3);
|
||||
$insert->bindValue(":winner4", $winningPlayer4);
|
||||
$insert->bindValue(":notes", $notes);
|
||||
|
||||
|
||||
|
||||
$insert->execute();
|
||||
|
||||
echo "Successfully uploaded new tournament record";
|
||||
|
||||
} catch (PDOException $e) { // failed connection
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
$conn = null;
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
159
admin/data_management/game_form.php
Normal file
159
admin/data_management/game_form.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include("../db_config.php"); // Include database stuff
|
||||
|
||||
try { // Try opening the SQL database connection
|
||||
$conn = new PDO("mysql:host=$servername; dbname=$dbName", $username, $password);
|
||||
// set the PDO error mode to exception
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
// Grab the list of users from the user list
|
||||
// We will also grab all the people that have been registered/won before
|
||||
$sqlGetUserData = $conn->prepare("SELECT username FROM " . $userTableName . "");
|
||||
$sqlGetTourneyData = $conn->prepare("SELECT tournamentName,winner1,winner2,winner3,winner4 FROM " . $tournamentDataTableName . "");
|
||||
|
||||
// Execute SQL query
|
||||
$sqlGetUserData->execute();
|
||||
$sqlGetTourneyData->execute();
|
||||
|
||||
// Get results from the USERS table
|
||||
$results = $sqlGetUserData->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Create new arrays to store values
|
||||
$userList = array();
|
||||
$tourneyList = array();
|
||||
|
||||
// Move results to their own array, easier to convert for Javascript
|
||||
foreach ($results as $result) {
|
||||
$userList[] = $result["username"];
|
||||
}
|
||||
|
||||
// Get results from the TOURNEY table
|
||||
$results = $sqlGetTourneyData->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Move results to their own array, easier to convert for Javascript
|
||||
foreach ($results as $result) {
|
||||
$userList[] = $result["winner1"];
|
||||
$userList[] = $result["winner2"];
|
||||
$userList[] = $result["winner3"];
|
||||
$userList[] = $result["winner4"];
|
||||
$tourneyList[] = $result["tournamentName"];
|
||||
}
|
||||
|
||||
// Remove duplicate entries
|
||||
$userList = array_unique($userList);
|
||||
|
||||
// Sort the array to alphabetical order
|
||||
sort($userList);
|
||||
|
||||
|
||||
} catch (PDOException $e) { // failed connection
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
||||
<?php include ("../db_config.php");?> <!-- Our password-length variable is stored here -->
|
||||
<link rel="stylesheet" href="../../styles/primary.css" />
|
||||
<link rel="stylesheet" href="../../styles/admin.css" />
|
||||
<link rel="stylesheet" href="../../styles/admin_nav.css" />
|
||||
<link rel="stylesheet" href="game_management.css" />
|
||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
|
||||
<script src="../../scripts/game_management.js"></script>
|
||||
<script src="../../scripts/trojan.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.js"></script>
|
||||
<title>GAME ADDING FORM</title>
|
||||
<script>
|
||||
$( function() {
|
||||
var userList = <?php echo json_encode($userList); ?>;
|
||||
|
||||
$(".playerInput").autocomplete({
|
||||
source: userList,
|
||||
});
|
||||
} );
|
||||
$( function() {
|
||||
var countries = ["Afghanistan","Albania","Algeria","Andorra","Angola","Anguilla","Antigua & Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia & Herzegovina","Botswana","Brazil","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Cayman Islands","Central Arfrican Republic","Chad","Chile","China","Colombia","Congo","Cook Islands","Costa Rica","Cote D Ivoire","Croatia","Cuba","Curacao","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland","France","French Polynesia","French West Indies","Gabon","Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guam","Guatemala","Guernsey","Guinea","Guinea Bissau","Guyana","Haiti","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macau","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Myanmar","Namibia","Nauro","Nepal","Netherlands","Netherlands Antilles","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","North Korea","Norway","Oman","Pakistan","Palau","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Puerto Rico","Qatar","Reunion","Romania","Russia","Rwanda","Saint Pierre & Miquelon","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Korea","South Sudan","Spain","Sri Lanka","St Kitts & Nevis","St Lucia","St Vincent","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Timor L'Este","Togo","Tonga","Trinidad & Tobago","Tunisia","Turkey","Turkmenistan","Turks & Caicos","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States of America","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Virgin Islands (US)","Yemen","Zambia","Zimbabwe"];
|
||||
var tournamentList = <?php echo json_encode($tourneyList); ?>;
|
||||
$("#tourneyName").autocomplete({
|
||||
source: tournamentList,
|
||||
position: {
|
||||
collision: "flip"
|
||||
},
|
||||
// This change is supposed to only allow listed items to be chosen
|
||||
change: function (event, ui) {
|
||||
if(!ui.item) {
|
||||
$("#tourneyName").val("");
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body id="generalBody">
|
||||
<div id="gameFormPanel">
|
||||
<form id="userForm" action="add_game.php" method="POST" autocomplete="off">
|
||||
<h2>ADD GAME RESULTS</h2>
|
||||
<p>Add a recently-played game and save the results!</p>
|
||||
<hr>
|
||||
<p></p>
|
||||
<div id="textInputArea">
|
||||
<label for="gameName">Game name</label>
|
||||
<input type="text" id="gameName" name="gameName" maxlength="100" tabindex="1" required>
|
||||
<p class="newLine"></p>
|
||||
<label for="gameName">Game date</label>
|
||||
<input type="date" id="gameDate" name="gameDate" max="<?php echo date("Y-m-d"); ?>" tabindex="1" required>
|
||||
<p class="newLine"></p>
|
||||
</div>
|
||||
<div class="optionsArea">
|
||||
<label for="numPlayers">Players:</label>
|
||||
<select id="numPlayers" name="numPlayers" tabindex="1" onchange="addPlayers()">
|
||||
<option value="1">1v1</option>
|
||||
<option value="2" selected="selected">2v2</option>
|
||||
<option value="3">3v3</option>
|
||||
<option value="4">4v4</option>
|
||||
</select>
|
||||
<label for="winners" class="showTeamSelector">Winning team:</label>
|
||||
<select id="winners" name="winners" class="showTeamSelector" tabindex="1">
|
||||
<option value="blue">Blue</option>
|
||||
<option value="orange">Orange</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="newLine"></p>
|
||||
<div id="playerDataInputArea">
|
||||
<table id="playerData">
|
||||
</table>
|
||||
<script>addPlayers();</script>
|
||||
<p class="newLine"></p>
|
||||
</div>
|
||||
<p class="newLine"></p>
|
||||
<div class="optionsArea">
|
||||
<p>If this game was part of a tournament, enter the name of it below</p>
|
||||
<input type="text" name="tourneyName" id="tourneyName" maxlength="150" tabindex="4">
|
||||
<p>If you have uploaded a replay of this game to <a href="https://ballchasing.com">ballchasing.com</a>, enter the ID code below.</p>
|
||||
<input type="text" name="ballchasingID" id="ballchasingID" maxlength="50" tabindex="4">
|
||||
<p class="newLine"></p>
|
||||
<p>If you have any notes about the game, leave them below</p>
|
||||
<textarea name="notes" id="notes" tabindex="4"></textarea>
|
||||
</div>
|
||||
|
||||
<p class="newLine"></p>
|
||||
|
||||
|
||||
<div id="submitButtonDiv">
|
||||
<p class="newLine"></p>
|
||||
<input type="submit" value="Submit" id="submitButton" tabindex="4">
|
||||
</div>
|
||||
<p class="newLine"></p>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
197
admin/data_management/game_management.css
Normal file
197
admin/data_management/game_management.css
Normal file
@ -0,0 +1,197 @@
|
||||
#gameFormPanel {
|
||||
width: 500px;
|
||||
min-height: 1000px;
|
||||
}
|
||||
|
||||
#gameFormPanel {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
#textInputArea {
|
||||
padding-left: 10px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.optionsArea {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#userForm input {
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
border-style: 1px solid blue;
|
||||
}
|
||||
|
||||
#userForm label {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#userForm input[type="submit"] {
|
||||
margin: auto;
|
||||
padding: 8px 25px;
|
||||
font-size: 150%;
|
||||
font-weight: bold;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
background-color: rgba(255, 255, 255, 0);
|
||||
border-radius: 6px;
|
||||
border: 1px solid blue;
|
||||
box-shadow: 0px 2px 4px;
|
||||
}
|
||||
|
||||
#userForm input[type="submit"]:hover {
|
||||
color: black;
|
||||
background-color: rgba(255, 165, 0, .6);
|
||||
}
|
||||
|
||||
#userForm input[type="submit"]:active {
|
||||
box-shadow: 0px 0px 2px;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
|
||||
#userForm input[type="text"] {
|
||||
flex: 1;
|
||||
align-items: flex-end;
|
||||
border-radius: 2px;
|
||||
padding: 3px 10px;
|
||||
margin: 0 6%;
|
||||
}
|
||||
|
||||
#userForm input[type="date"] {
|
||||
flex: 1;
|
||||
border-radius: 2px;
|
||||
width: 100px;
|
||||
padding: 3px 10px;
|
||||
margin: 0 6%;
|
||||
text-align: center;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
#userForm select {
|
||||
border: 1px solid black;
|
||||
border-radius: 2px;
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
padding: 3px 10px;
|
||||
margin: 0 3%;
|
||||
}
|
||||
.playerInput input[type="text"]{
|
||||
flex: 1;
|
||||
width: 150px;
|
||||
}
|
||||
.teamInput input[type="text"]{
|
||||
flex: 1;
|
||||
width: 175px;
|
||||
}
|
||||
|
||||
#playerDataInputArea {
|
||||
height: 370px;
|
||||
width: 85%;
|
||||
border: 1px solid black;
|
||||
border-radius: 5px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#playerData {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#playerData input[type="text"]{
|
||||
width: 90%;
|
||||
border-radius: 2px;
|
||||
padding: 3px 0;
|
||||
margin: 0 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#playerTableMiddleSpacer {
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
.tableSubHeader {
|
||||
font-size: 70%;
|
||||
}
|
||||
#teamNameHeader {
|
||||
font-size: 85%;
|
||||
}
|
||||
#scoreHeader {
|
||||
font-size: 85%;
|
||||
}
|
||||
#scoreRow {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#scoreRow input[type="text"] {
|
||||
width: 50px;
|
||||
border-radius: 6px;
|
||||
padding: 6px 6px;
|
||||
margin: 0 0;
|
||||
text-align: center;
|
||||
font-size: 130%;
|
||||
}
|
||||
|
||||
.tableHeader {
|
||||
font-weight: bold;
|
||||
font-size: 125%;
|
||||
}
|
||||
|
||||
#submitButtonDiv {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
#submitButton {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#tourneyName {
|
||||
width:100%;
|
||||
padding: 3px 0;
|
||||
margin: 0 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#ballchasingID {
|
||||
width:100%;
|
||||
padding: 3px 0;
|
||||
margin: 0 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#notes {
|
||||
width: 80%;
|
||||
height: 100px;
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.showTeamSelector {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
This section affects the auto-complete menu for player names
|
||||
*/
|
||||
.ui-menu {
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
border: 1px solid black;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.ui-autocomplete {
|
||||
max-height: 200px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
width: 120px;
|
||||
}
|
152
admin/data_management/tourney_form.php
Normal file
152
admin/data_management/tourney_form.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include("../db_config.php"); // Include database stuff
|
||||
|
||||
try { // Try opening the SQL database connection
|
||||
$conn = new PDO("mysql:host=$servername; dbname=$dbName", $username, $password);
|
||||
// set the PDO error mode to exception
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
// Grab the list of users from the user list
|
||||
// We will also grab all the people that have been registered/won before
|
||||
$sqlGetUserData = $conn->prepare("SELECT username FROM " . $userTableName . "");
|
||||
$sqlGetTourneyData = $conn->prepare("SELECT winner1,winner2,winner3,winner4 FROM " . $tournamentDataTableName . "");
|
||||
|
||||
// Execute SQL query
|
||||
$sqlGetUserData->execute();
|
||||
$sqlGetTourneyData->execute();
|
||||
|
||||
// Get results from the USERS table
|
||||
$results = $sqlGetUserData->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Create array to store values
|
||||
$userList = array();
|
||||
|
||||
// Move results to their own array, easier to convert for Javascript
|
||||
foreach ($results as $result) {
|
||||
$userList[] = $result["username"];
|
||||
}
|
||||
|
||||
|
||||
// Get results from the TOURNEY table
|
||||
$results = $sqlGetTourneyData->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Move results to their own array, easier to convert for Javascript
|
||||
foreach ($results as $result) {
|
||||
$userList[] = $result["winner1"];
|
||||
$userList[] = $result["winner2"];
|
||||
$userList[] = $result["winner3"];
|
||||
$userList[] = $result["winner4"];
|
||||
}
|
||||
|
||||
|
||||
$userList = array_unique($userList);
|
||||
// Sort the array to alphabetical order
|
||||
sort($userList);
|
||||
|
||||
} catch (PDOException $e) { // failed connection
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
||||
<?php include ("../db_config.php");?> <!-- Our password-length variable is stored here -->
|
||||
<link rel="stylesheet" href="../../styles/primary.css" />
|
||||
<link rel="stylesheet" href="../../styles/admin.css" />
|
||||
<link rel="stylesheet" href="../../styles/admin_nav.css" />
|
||||
<link rel="stylesheet" href="tourney_management.css" />
|
||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
|
||||
<script src="../../scripts/tourney_management.js"></script>
|
||||
<script src="../../scripts/trojan.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.js"></script>
|
||||
<title>TOURNAMENT ADDING FORM</title>
|
||||
<script>
|
||||
$( function() {
|
||||
var userList = <?php echo json_encode($userList); ?>;
|
||||
|
||||
$(".playerInput").autocomplete({
|
||||
source: userList,
|
||||
});
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body id="generalBody">
|
||||
<div id="tourneyFormPanel">
|
||||
<form id="userForm" action="add_tourney.php" method="POST" autocomplete="off">
|
||||
<h2>ADD NEW TOURNAMENT</h2>
|
||||
<p>Add a recently-played tournament and record the victors.</p>
|
||||
<p>Users will be able to add their own replays and information to the tournaments (later).</p>
|
||||
<p>This is also how trophies will be tracked!</p>
|
||||
<hr>
|
||||
<p></p>
|
||||
<div id="textInputArea">
|
||||
<label for="tourneyName">Tournament name</label>
|
||||
<input type="text" id="tourneyName" name="tourneyName" maxlength="150" tabindex="1" required>
|
||||
<p class="newLine"></p>
|
||||
<label for="tourneyName">Tournament date</label>
|
||||
<input type="date" id="tourneyDate" name="tourneyDate" max="<?php echo date("Y-m-d"); ?>" tabindex="1" required>
|
||||
<p class="newLine"></p>
|
||||
</div>
|
||||
<div class="optionsArea">
|
||||
<label for="division">Division:</label>
|
||||
<select id="division" name="division" tabindex="1">
|
||||
<option value="main">Main</option>
|
||||
<option value="intermediate">Intermediate</option>
|
||||
<option value="open">Open</option>
|
||||
</select>
|
||||
<p class="newLine"></p>
|
||||
<label for="numPlayers">Players:</label>
|
||||
<select id="numPlayers" name="numPlayers" tabindex="1" onchange="addPlayers()">
|
||||
<option value="1">1v1</option>
|
||||
<option value="2" selected="selected">2v2</option>
|
||||
<option value="3">3v3</option>
|
||||
<option value="4">4v4</option>
|
||||
</select>
|
||||
<label for="bestOf">Best of:</label>
|
||||
<select id="bestOf" name="bestOf" tabindex="1">
|
||||
<option value="1">1</option>
|
||||
<option value="3" selected="selected">3</option>
|
||||
<option value="5">5</option>
|
||||
<option value="7">7</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="newLine"></p>
|
||||
<div id="playerDataInputArea">
|
||||
<p id="teamNameHeader">WINNING TEAM NAME:</p>
|
||||
<input type="text" name="winningTeamName" class="teamInput" maxlength="35" tabindex="1">
|
||||
<h4>Roster</h4>
|
||||
<table id="playerData">
|
||||
</table>
|
||||
<script>addPlayers();</script>
|
||||
<p class="newLine"></p>
|
||||
</div>
|
||||
<p class="newLine"></p>
|
||||
<div class="optionsArea">
|
||||
<p class="newLine"></p>
|
||||
<p>If you have any notes about the tournament, leave them below</p>
|
||||
<textarea name="notes" id="notes" tabindex="4"></textarea>
|
||||
<p class="newLine"></p>
|
||||
<p>Once the tournament is created, users will be able to attribute their games to it through the game creation/editing screen.</p>
|
||||
</div>
|
||||
|
||||
<p class="newLine"></p>
|
||||
|
||||
|
||||
<div id="submitButtonDiv">
|
||||
<p class="newLine"></p>
|
||||
<input type="submit" value="Submit" id="submitButton" tabindex="4">
|
||||
</div>
|
||||
<p class="newLine"></p>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
193
admin/data_management/tourney_management.css
Normal file
193
admin/data_management/tourney_management.css
Normal file
@ -0,0 +1,193 @@
|
||||
#tourneyFormPanel {
|
||||
width: 500px;
|
||||
min-height: 1000px;
|
||||
}
|
||||
|
||||
#tourneyFormPanel {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
#textInputArea {
|
||||
padding-left: 10px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.optionsArea {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#userForm input {
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
border-style: 1px solid blue;
|
||||
}
|
||||
|
||||
#userForm label {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#userForm input[type="submit"] {
|
||||
margin: auto;
|
||||
padding: 8px 25px;
|
||||
font-size: 150%;
|
||||
font-weight: bold;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
background-color: rgba(255, 255, 255, 0);
|
||||
border-radius: 6px;
|
||||
border: 1px solid blue;
|
||||
box-shadow: 0px 2px 4px;
|
||||
}
|
||||
|
||||
#userForm input[type="submit"]:hover {
|
||||
color: black;
|
||||
background-color: rgba(255, 165, 0, .6);
|
||||
}
|
||||
|
||||
#userForm input[type="submit"]:active {
|
||||
box-shadow: 0px 0px 2px;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
|
||||
#userForm input[type="text"] {
|
||||
flex: 1;
|
||||
align-items: flex-end;
|
||||
border-radius: 2px;
|
||||
padding: 3px 10px;
|
||||
margin: 0 6%;
|
||||
}
|
||||
|
||||
#userForm input[type="date"] {
|
||||
flex: 1;
|
||||
border-radius: 2px;
|
||||
width: 100px;
|
||||
padding: 3px 10px;
|
||||
margin: 0 6%;
|
||||
text-align: center;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
#userForm select {
|
||||
border: 1px solid black;
|
||||
border-radius: 2px;
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
padding: 3px 10px;
|
||||
margin: 0 3%;
|
||||
}
|
||||
.playerInput input[type="text"]{
|
||||
flex: 1;
|
||||
width: 150px;
|
||||
}
|
||||
.teamInput input[type="text"]{
|
||||
flex: 1;
|
||||
width: 60%;
|
||||
}
|
||||
.teamInput input[type="text"]{
|
||||
flex: 1;
|
||||
width: 60%;
|
||||
}
|
||||
.teamInput {
|
||||
width: 60%;
|
||||
text-align: center;
|
||||
}
|
||||
#playerDataInputArea {
|
||||
height: 280px;
|
||||
width: 75%;
|
||||
border: 1px solid black;
|
||||
border-radius: 5px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#playerData {
|
||||
margin: auto;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
#playerData input[type="text"]{
|
||||
width: 90%;
|
||||
border-radius: 2px;
|
||||
padding: 3px 0;
|
||||
margin: 0 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#playerTableMiddleSpacer {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.tableSubHeader {
|
||||
font-size: 100%;
|
||||
}
|
||||
#teamNameHeader {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
.tableHeader {
|
||||
font-weight: bold;
|
||||
font-size: 125%;
|
||||
}
|
||||
|
||||
#submitButtonDiv {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
#submitButton {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#tourneyName {
|
||||
width:100%;
|
||||
padding: 3px 0;
|
||||
margin: 0 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#ballchasingID {
|
||||
width:100%;
|
||||
padding: 3px 0;
|
||||
margin: 0 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#notes {
|
||||
width: 80%;
|
||||
height: 100px;
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.showTeamSelector {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#teamNameHeader {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*
|
||||
This section affects the auto-complete menu for player names
|
||||
*/
|
||||
.ui-menu {
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
border: 1px solid black;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.ui-autocomplete {
|
||||
max-height: 200px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
width: 120px;
|
||||
}
|
@ -25,7 +25,8 @@ include ("dev_db_config.php");
|
||||
|
||||
|
||||
$userTableName = "users"; // name of the table containing user data
|
||||
$dataTableName = "replays"; // table containing replay data
|
||||
$gameDataTableName = "games"; // table containing replay data
|
||||
$tournamentDataTableName = "tournaments"; // tournament data table
|
||||
$trophyTableName = "trophies"; // trophy data table
|
||||
$adminUserTableName = "safeadmins";
|
||||
|
||||
@ -75,23 +76,53 @@ userUpdated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
)";
|
||||
|
||||
|
||||
// REPLAYS DATA TABLE
|
||||
// GAME DATA TABLE
|
||||
$sqlCreateDataTable = "
|
||||
CREATE TABLE " . $dataTableName . " (
|
||||
replayID INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
ballchasingID VARCHAR(100),
|
||||
replayName VARCHAR(150),
|
||||
CREATE TABLE " . $gameDataTableName . " (
|
||||
gameID INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
gameName VARCHAR(100),
|
||||
gameDate DATE,
|
||||
uploadedBy VARCHAR(30),
|
||||
uploadedByID INT(8) UNSIGNED,
|
||||
numPlayers TINYINT UNSIGNED,
|
||||
player1 VARCHAR(30),
|
||||
player2 VARCHAR(30),
|
||||
player3 VARCHAR(30),
|
||||
player4 VARCHAR(30),
|
||||
player5 VARCHAR(30),
|
||||
player6 VARCHAR(30),
|
||||
player7 VARCHAR(30),
|
||||
player8 VARCHAR(30),
|
||||
notes VARCHAR(1000)
|
||||
winningTeam VARCHAR(6),
|
||||
blueTeamName VARCHAR(35),
|
||||
blueScore INT(3),
|
||||
orangeTeamName VARCHAR(35),
|
||||
orangeScore INT(3),
|
||||
bluePlayer1 VARCHAR(30),
|
||||
bluePlayer2 VARCHAR(30),
|
||||
bluePlayer3 VARCHAR(30),
|
||||
bluePlayer4 VARCHAR(30),
|
||||
orangePlayer1 VARCHAR(30),
|
||||
orangePlayer2 VARCHAR(30),
|
||||
orangePlayer3 VARCHAR(30),
|
||||
orangePlayer4 VARCHAR(30),
|
||||
tournamentName VARCHAR(150),
|
||||
ballchasingID VARCHAR(50),
|
||||
notes VARCHAR(1000),
|
||||
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
)";
|
||||
|
||||
|
||||
// TOURNAMENT DATA TABLE
|
||||
$sqlCreateTournamentTable = "
|
||||
CREATE TABLE " . $tournamentDataTableName . " (
|
||||
tournamentID INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
tournamentName VARCHAR(150),
|
||||
tournamentDate DATE,
|
||||
tournamentDivision VARCHAR(20),
|
||||
numPlayers TINYINT UNSIGNED,
|
||||
bestOf TINYINT UNSIGNED,
|
||||
winningTeamName VARCHAR(35),
|
||||
winner1 VARCHAR(30),
|
||||
winner2 VARCHAR(30),
|
||||
winner3 VARCHAR(30),
|
||||
winner4 VARCHAR(30),
|
||||
notes VARCHAR(1000),
|
||||
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
)";
|
||||
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
////////// USER DATA ///////////
|
||||
|
||||
echo "<p>Creating user data table...</p>";
|
||||
// Check if the users table exists already
|
||||
$sqlCheckUserTable = $conn->prepare("SHOW TABLES LIKE '" . $userTableName . "'");
|
||||
|
||||
@ -67,11 +66,10 @@
|
||||
echo "<p>Copied!</p>";
|
||||
|
||||
|
||||
//////// REPLAY DATA ////////
|
||||
echo "<p>Creating replay data table...</p>";
|
||||
//////// GAME DATA ////////
|
||||
|
||||
// Check if the replay data table exists already
|
||||
$sqlCheckDataTable = $conn->prepare("SHOW TABLES LIKE '" . $dataTableName . "'");
|
||||
$sqlCheckDataTable = $conn->prepare("SHOW TABLES LIKE '" . $gameDataTableName . "'");
|
||||
|
||||
// Run the query
|
||||
$sqlCheckDataTable->execute();
|
||||
@ -80,26 +78,61 @@
|
||||
$count = $sqlCheckDataTable->rowCount();
|
||||
|
||||
if ($count != 0) {
|
||||
echo "<p>Deleting exsiting table '" . $dataTableName . "'...</p>";
|
||||
echo "<p>Deleting exsiting table '" . $gameDataTableName . "'...</p>";
|
||||
// Create the query to drop the table
|
||||
$sqlDropDataTable = "DROP TABLE " . $dataTableName;
|
||||
$sqlDropDataTable = "DROP TABLE " . $gameDataTableName;
|
||||
$conn->exec($sqlDropDataTable); // drop the table
|
||||
echo "<p>Deleted!</p><p>Creating new table '" . $dataTableName . "'...</p>";
|
||||
echo "<p>Deleted!</p><p>Creating new table '" . $gameDataTableName . "'...</p>";
|
||||
try { // Create the new table
|
||||
$conn->query($sqlCreateDataTable);
|
||||
echo "<p>Table '" . $dataTableName . "' successfully created (replay data)</p>";
|
||||
echo "<p>Table '" . $gameDataTableName . "' successfully created (saved game data)</p>";
|
||||
} catch (PDOException $e) {
|
||||
echo $sqlCreateDataTable . "<br>" . $e->getMessage();
|
||||
}
|
||||
} else { // If the table doesn't already exist, we'll just create it
|
||||
try {
|
||||
$conn->query($sqlCreateDataTable);
|
||||
echo "<p>Table '" . $dataTableName . "' successfully created (replay data)</p>";
|
||||
echo "<p>Table '" . $gameDataTableName . "' successfully created (saved game data)</p>";
|
||||
} catch (PDOException $e) {
|
||||
echo $sqlCreateDataTable . "<br>" . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
//////// TOURNAMENT DATA ////////
|
||||
|
||||
|
||||
// Check if the replay data table exists already
|
||||
$sqlCheckTournamentTable = $conn->prepare("SHOW TABLES LIKE '" . $tournamentDataTableName . "'");
|
||||
|
||||
// Run the query
|
||||
$sqlCheckTournamentTable->execute();
|
||||
|
||||
//Check if any rows exist - if not, create the table, if yes, destroy it first, then create it
|
||||
$count = $sqlCheckTournamentTable->rowCount();
|
||||
|
||||
if ($count != 0) {
|
||||
echo "<p>Deleting exsiting table '" . $tournamentDataTableName . "'...</p>";
|
||||
// Create the query to drop the table
|
||||
$sqlDropTournamentTable = "DROP TABLE " . $tournamentDataTableName;
|
||||
$conn->exec($sqlDropTournamentTable); // drop the table
|
||||
echo "<p>Deleted!</p><p>Creating new table '" . $tournamentDataTableName . "'...</p>";
|
||||
try { // Create the new table
|
||||
$conn->query($sqlCreateTournamentTable);
|
||||
echo "<p>Table '" . $tournamentDataTableName . "' successfully created (tournament data)</p>";
|
||||
} catch (PDOException $e) {
|
||||
echo $sqlCreateTournamentTable . "<br>" . $e->getMessage();
|
||||
}
|
||||
} else { // If the table doesn't already exist, we'll just create it
|
||||
try {
|
||||
$conn->query($sqlCreateTournamentTable);
|
||||
echo "<p>Table '" . $tournamentDataTableName . "' successfully created (tournament data)</p>";
|
||||
} catch (PDOException $e) {
|
||||
echo $sqlCreateTournamentTable . "<br>" . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//////// TROPHY DATA ////////
|
||||
echo "<p>Creating trophy data table...</p>";
|
||||
|
||||
@ -132,7 +165,7 @@
|
||||
echo $sqlCreateTrophyTable . "<br>" . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
$conn = null; // Close the connection
|
||||
|
||||
// Tell the use we're done
|
||||
|
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
// DB LOGIN DETAILS HERE
|
||||
|
||||
$servername = "127.0.0.1";
|
||||
$username = "trojandestinyrl";
|
||||
$password = "f4f7L2aexOUXLkV";
|
||||
$dbName = "dev";
|
||||
|
||||
ini_set('display_startup_errors', 1);
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(-1);
|
||||
?>
|
@ -10,7 +10,6 @@ session_start();
|
||||
<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/admin.css" />
|
||||
<link rel="stylesheet" href="../styles/admin_nav.css" />
|
||||
<script src="../scripts/trojan.js"></script>
|
||||
<title>ADMIN PANEL - Trojan's Trophy Room</title>
|
||||
</head>
|
||||
@ -47,10 +46,21 @@ session_start();
|
||||
//Check if any rows exist
|
||||
$count = $sqlCheckAdminTable->rowCount();
|
||||
|
||||
$count = 1;
|
||||
|
||||
// EVENTUALLY WE NEED TO MAKE SURE THE PERSON LOGGED IN IS AN ADMIN
|
||||
|
||||
/* This if-statement controls the display of the admin page
|
||||
// First we check if there's actually gonna be an admin user
|
||||
// - we do this by checking the safe-admin database, because
|
||||
// if there's at least one user there, they would have been
|
||||
// copied into the primary user database upon initialization
|
||||
//
|
||||
// Then we check if the person is logged in or not - if not,
|
||||
// we re-direct them to the login page, where we'll be
|
||||
// brought back after logging in
|
||||
//
|
||||
// We are also checking if the person is an admin user -
|
||||
// if they are NOT, then we show the 'not_admin' page,
|
||||
// telling the user they're not allowed to view the content
|
||||
*/
|
||||
|
||||
if ($count == 0) { // If no safe admins are found, we'll force creation of one
|
||||
echo "<iframe src=\"user_management/create_safe_admin.php\" name=\"dataFrame\" class=\"dataFrame\" id=\"dataFrame\" onload=\"resizeIframe(this);\"></iframe>";
|
||||
@ -66,17 +76,17 @@ session_start();
|
||||
?>
|
||||
|
||||
|
||||
<div id="subNav">
|
||||
<div class="subNav">
|
||||
<?php
|
||||
if (isset($_SESSION["isAdmin"]) && $_SESSION["isAdmin"] == 1) {
|
||||
echo "<a href=\"./\" class=\"navLink\" id=\"adminHomeButton\">ADMIN HOME</a>";
|
||||
echo "<a href=\"./\" class=\"subNavLink\" id=\"adminHomeButton\">ADMIN HOME</a>";
|
||||
}
|
||||
?>
|
||||
<a href="../" class="navLink" id="mainHomeButton">MAIN HOME</a>
|
||||
<a href="../" class="subNavLink" id="mainHomeButton">MAIN HOME</a>
|
||||
<p class="newLine"></p>
|
||||
<?php
|
||||
if (isset($_SESSION["userID"])){
|
||||
echo "<a href=\"../logout.php?redirect=admin\" class=\"navLink\" id=\"logoutButton\">LOGOUT</a>";
|
||||
echo "<a href=\"../logout.php?redirect=admin\" class=\"subNavLink\" id=\"loginButton\">LOGOUT</a>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -12,7 +12,7 @@ session_start();
|
||||
<link rel="stylesheet" href="../styles/admin.css" />
|
||||
<link rel="stylesheet" href="../styles/admin_nav.css" />
|
||||
<script src="../scripts/trojan.js"></script>
|
||||
<title>NOT AN ADMIN</title>
|
||||
<title>NOT ALLOWED</title>
|
||||
</head>
|
||||
|
||||
<body id="notAnAdmin">
|
||||
|
@ -6,7 +6,6 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
||||
<link rel="stylesheet" href="db_management.css" />
|
||||
<!-- <script src="trojan.js"></script>-->
|
||||
<title>no title</title>
|
||||
</head>
|
||||
|
||||
@ -20,8 +19,6 @@
|
||||
$conn = new PDO("mysql:host=$servername; dbname=$dbName", $username, $password);
|
||||
// set the PDO error mode to exception
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
echo "<p>Connected successfully</p>";
|
||||
|
||||
|
||||
// Variables for the various input fields
|
||||
$username = $_POST["username"];
|
||||
|
@ -20,17 +20,17 @@
|
||||
<p></p>
|
||||
<form id="userForm" action="add_user.php" onsubmit="return verifyInput()" method="POST" target="dataFrame">
|
||||
<!-- THIS DIV IS FOR INPUT -->
|
||||
<div id="inputArea">
|
||||
<div id="textInputArea">
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" id="username" name="username" />
|
||||
<input type="text" id="username" name="username" maxlength="30" />
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" name="password" />
|
||||
<label for="discord">Discord:</label>
|
||||
<input type="text" id="discord" name="discord" />
|
||||
<input type="text" id="discord" name="discord" maxlength="50"/>
|
||||
<label for="twitch">Twitch:</label>
|
||||
<input type="text" id="twitch" name="twitch" />
|
||||
<input type="text" id="twitch" name="twitch" maxlength="50" />
|
||||
<label for="youtube">Youtube:</label>
|
||||
<input type="text" id="youtube" name="youtube" />
|
||||
<input type="text" id="youtube" name="youtube" maxlength="50" />
|
||||
</div>
|
||||
<hr>
|
||||
<!-- THIS DIV IS FOR PASSWORD SETTINGS -->
|
||||
|
@ -43,7 +43,7 @@
|
||||
}
|
||||
|
||||
|
||||
#inputArea {
|
||||
#textInputArea {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: column;
|
||||
|
BIN
assets/trophy_intermediate.png
Normal file
BIN
assets/trophy_intermediate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
BIN
assets/trophy_main.png
Normal file
BIN
assets/trophy_main.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
BIN
assets/trophy_open.png
Normal file
BIN
assets/trophy_open.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
@ -1,3 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
@ -22,15 +25,15 @@
|
||||
</thead>
|
||||
<tr>
|
||||
<td class="divTableLeftColumn">Open</td>
|
||||
<td class="divTableRightColumn"><img src="assets/plat3.webp" title="Plat 3" alt="plat 3" width="30px"></td>
|
||||
<td class="divTableRightColumn"><img src="assets/plat3.webp" title="Plat 3" alt="plat 3" width="40px"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="divTableLeftColumn">Intermediate</td>
|
||||
<td class="divTableRightColumn"><img src="assets/champ3.webp" title="Champ 3" alt="champ 3" width="30px"></td>
|
||||
<td class="divTableRightColumn"><img src="assets/champ3.webp" title="Champ 3" alt="champ 3" width="40px"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="divTableLeftColumn">Main</td>
|
||||
<td class="divTableRightColumn"><img src="assets/SSL.webp" title="SSL" alt="Supersonic Legend" width="30px"></td>
|
||||
<td class="divTableRightColumn"><img src="assets/SSL.webp" title="SSL" alt="Supersonic Legend" width="40px"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
18
index.php
18
index.php
@ -15,8 +15,9 @@ session_start();
|
||||
<body id="body">
|
||||
<div id="contentFrame">
|
||||
<h1>Trojan's Trophy Room</h1>
|
||||
<h4><a href="/giveaway" id="giveawayLink">Giveaway Disclaimer</a></h4>
|
||||
<h3>Choose a division to see results!</h3>
|
||||
<div id="navPanel">
|
||||
<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>
|
||||
@ -27,18 +28,21 @@ session_start();
|
||||
<iframe src="open.html" name="dataFrame" class="dataFrame" id="dataFrame" onload="resizeIframe(this);"></iframe>
|
||||
<p class="newLine"></p>
|
||||
<p class="newLine"></p>
|
||||
<div id="subNav">
|
||||
<div class="subNav">
|
||||
<?php
|
||||
// Is the user is logged in we'll show them a navigation bar with some fancier options
|
||||
if (isset($_SESSION["userID"])){
|
||||
echo "<a href=\"logout.php \" class=\"navLink\" id=\"logoutButton\">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>";
|
||||
// Anything we need to show to logged in admins will be below
|
||||
if (isset($_SESSION["isAdmin"]) && $_SESSION["isAdmin"] == 1){
|
||||
echo "<a href=\"admin \" class=\"subNavLink\">ADMIN PANEL</a>";
|
||||
}
|
||||
} else {
|
||||
echo "<a href=\"login_page.php \" target=\"dataFrame\" class=\"navLink\" id=\"loginButton\">SIGN IN</a>";
|
||||
echo "<a href=\"login_page.php \" target=\"dataFrame\" class=\"subNavLink\">SIGN IN</a>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -18,38 +18,47 @@
|
||||
<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>
|
||||
|
20
login.php
20
login.php
@ -30,26 +30,23 @@ session_start();
|
||||
$password = $_POST["password"];
|
||||
|
||||
|
||||
|
||||
// THIS SHOULD BE MADE MORE EFFICIENT WITH ONLY ONE QUERY IF POSSIBLE
|
||||
// Grab the password hash for the username (if available)
|
||||
$sqlGetPasswordHash = $conn->prepare("SELECT password FROM " . $userTableName . " WHERE username=\"" . $username . "\"");
|
||||
$sqlGetUserID = $conn->prepare("SELECT userID FROM " . $userTableName . " WHERE username=\"" . $username . "\"");
|
||||
$sqlGetisAdmin = $conn->prepare("SELECT isAdmin FROM " . $userTableName . " WHERE username=\"" . $username . "\"");
|
||||
$sqlGetData = $conn->prepare("SELECT userID,password,isAdmin FROM " . $userTableName . " WHERE username=\"" . $username . "\"");
|
||||
|
||||
$sqlGetPasswordHash->execute();
|
||||
$sqlGetUserID->execute();
|
||||
$sqlGetisAdmin->execute();
|
||||
$sqlGetData->execute();
|
||||
|
||||
|
||||
} catch (PDOException $e) { // failed connection
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
$result = $sqlGetData->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// Grab the hash from the fetched SQL data
|
||||
$passwordHash = $sqlGetPasswordHash->fetchColumn();
|
||||
$userID = $sqlGetUserID->fetchColumn();
|
||||
$isAdmin = $sqlGetisAdmin->fetchColumn();
|
||||
$passwordHash = $result["password"];
|
||||
$userID = $result["userID"];
|
||||
$isAdmin = $result["isAdmin"];
|
||||
|
||||
|
||||
// Verify that the entered password matches the hashed one
|
||||
@ -58,6 +55,7 @@ if (password_verify($password, $passwordHash)) {
|
||||
$_SESSION["userID"] = $userID;
|
||||
$_SESSION["username"] = $username;
|
||||
$_SESSION["isAdmin"] = $isAdmin;
|
||||
|
||||
// Function from StackOverflow used to get the base URL, to which we append
|
||||
// the redirect (where the user came from)
|
||||
function url(){
|
||||
@ -70,7 +68,7 @@ if (password_verify($password, $passwordHash)) {
|
||||
}
|
||||
|
||||
$address = url();
|
||||
echo "<p>$address</p>";
|
||||
echo "<p>Redirecting to <a href=\"$address\">$address</a>...</p>";
|
||||
|
||||
echo "<script>window.top.location.href = \"" . $address . "\";</script>";
|
||||
|
||||
|
@ -18,22 +18,27 @@
|
||||
<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>
|
||||
|
94
scripts/game_management.js
Normal file
94
scripts/game_management.js
Normal file
@ -0,0 +1,94 @@
|
||||
function addPlayers(){
|
||||
// Get number of players from drop-down on page
|
||||
var numberPlayers = document.getElementById("numPlayers").value;
|
||||
|
||||
// Grab the table for the input data
|
||||
playerDataTable = document.getElementById("playerData");
|
||||
|
||||
playerDataTable.innerHTML = ""; // Clear table
|
||||
|
||||
// Create the score row
|
||||
var scoreRow = playerDataTable.insertRow(-1);
|
||||
var scoreBlue = scoreRow.insertCell(0);
|
||||
var scoreHeader = scoreRow.insertCell(1);
|
||||
var scoreOrange = scoreRow.insertCell(2);
|
||||
|
||||
scoreRow.id = "scoreRow";
|
||||
|
||||
scoreBlue.innerHTML = "<input type=\"text\" name=\"blueScore\" class=\"scoreInput\" id=\"blueScore\" maxlength=\"3\" oninput=\"checkIfScoreTied()\" tabindex=\"1\" required>";
|
||||
scoreHeader.innerHTML = "<p id=\"scoreHeader\">SCORE</p>";
|
||||
scoreOrange.innerHTML = "<input type=\"text\" name=\"orangeScore\" class=\"scoreInput\" id=\"orangeScore\" maxlength=\"3\" oninput=\"checkIfScoreTied()\" tabindex=\"1\" required>";
|
||||
|
||||
// Create the header row
|
||||
var header = playerDataTable.insertRow(-1);
|
||||
var blueHeader = header.insertCell(0);
|
||||
var headerSpacer = header.insertCell(1);
|
||||
var orangeHeader = header.insertCell(2);
|
||||
|
||||
blueHeader.innerHTML = "<p class=\"tableHeader\">BLUE</p>";
|
||||
headerSpacer.innerHTML = "<p id=\"playerTableMiddleSpacer\" class=\"tableHeader\"></p>";
|
||||
orangeHeader.innerHTML = "<p class=\"tableHeader\">ORANGE</p>";
|
||||
|
||||
|
||||
// Create the teamname row
|
||||
var teamNames = playerDataTable.insertRow(-1);
|
||||
hometeamName = teamNames.insertCell(0);
|
||||
teamNameHeader = teamNames.insertCell(1);
|
||||
awayteamName = teamNames.insertCell(2);
|
||||
|
||||
|
||||
hometeamName.innerHTML = "<input type=\"text\" name=\"blueTeamName\" class=\"teamInput\" maxlength=\"35\" tabindex=\"1\">";
|
||||
teamNameHeader.innerHTML = "<p id=\"teamNameHeader\"><pre>TEAM\nNAME</pre></p>";
|
||||
awayteamName.innerHTML = "<input type=\"text\" name=\"orangeTeamName\" class=\"teamInput\" maxlength=\"35\" tabindex=\"1\">";
|
||||
|
||||
|
||||
// Create the subheader
|
||||
var subHeader = playerDataTable.insertRow(-1);
|
||||
homeSubHeader = subHeader.insertCell(0);
|
||||
playerSubHeader = subHeader.insertCell(1);
|
||||
awaySubHeader = subHeader.insertCell(2);
|
||||
|
||||
|
||||
homeSubHeader.innerHTML = "<p class=\"tableSubHeader\">HOME</p>";
|
||||
playerSubHeader.innerHTML = "<p class=\"tableSubHeader\">PLAYER</p>";
|
||||
awaySubHeader.innerHTML = "<p class=\"tableSubHeader\">AWAY</p>";
|
||||
|
||||
// Finally create the appropriate number of rows for players, based on the user input
|
||||
for (var i = 1; i <= numberPlayers; i++) {
|
||||
row = playerDataTable.insertRow(-1);
|
||||
var bluePlayer = row.insertCell(0);
|
||||
var playerNum = row.insertCell(1);
|
||||
var orangePlayer = row.insertCell(2);
|
||||
bluePlayer.innerHTML = "<input type=\"text\" name=\"bluePlayer" + i + "\" id=\"" + i + "\" class=\"playerInput\" maxlength=\"30\" tabindex=\"2\">";
|
||||
playerNum.innerHTML = "- " + i + " -";
|
||||
orangePlayer.innerHTML = "<input type=\"text\" name=\"orangePlayer" + i + "\" id=\"" + i + "\" class=\"playerInput\" maxlength=\"30\" tabindex=\"3\">";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function checkIfScoreTied() {
|
||||
var blueScore = document.getElementById("blueScore").value;
|
||||
var orangeScore = document.getElementById("orangeScore").value;
|
||||
|
||||
var optionsToShow = document.getElementsByClassName("showTeamSelector");
|
||||
|
||||
if (!blueScore) {
|
||||
blueScore = 0;
|
||||
}
|
||||
if (!orangeScore) {
|
||||
orangeScore = 0;
|
||||
}
|
||||
|
||||
|
||||
if (blueScore == orangeScore) {
|
||||
if (blueScore != 0) {
|
||||
for (var i = 0; i < optionsToShow.length; i++) {
|
||||
optionsToShow[i].style.visibility = "visible";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < optionsToShow.length; i++) {
|
||||
optionsToShow[i].style.visibility = "hidden";
|
||||
}
|
||||
}
|
||||
}
|
46
scripts/tourney_management.js
Normal file
46
scripts/tourney_management.js
Normal file
@ -0,0 +1,46 @@
|
||||
function addPlayers(){
|
||||
// Get number of players from drop-down on page
|
||||
var numberPlayers = document.getElementById("numPlayers").value;
|
||||
|
||||
// Grab the table for the input data
|
||||
playerDataTable = document.getElementById("playerData");
|
||||
|
||||
playerDataTable.innerHTML = ""; // Clear table
|
||||
|
||||
// Create the appropriate number of rows for players, based on the user input
|
||||
for (var i = 1; i <= numberPlayers; i++) {
|
||||
row = playerDataTable.insertRow(-1);
|
||||
var playerNum = row.insertCell(0);
|
||||
var playerName = row.insertCell(1);
|
||||
playerNum.innerHTML = i + " -";
|
||||
playerName.innerHTML = "<input type=\"text\" name=\"winningPlayer" + i + "\" id=\"" + i + "\" class=\"playerInput\" maxlength=\"30\" tabindex=\"3\">";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function checkIfScoreTied() {
|
||||
var blueScore = document.getElementById("blueScore").value;
|
||||
var orangeScore = document.getElementById("orangeScore").value;
|
||||
|
||||
var optionsToShow = document.getElementsByClassName("showTeamSelector");
|
||||
|
||||
if (!blueScore) {
|
||||
blueScore = 0;
|
||||
}
|
||||
if (!orangeScore) {
|
||||
orangeScore = 0;
|
||||
}
|
||||
|
||||
|
||||
if (blueScore == orangeScore) {
|
||||
if (blueScore != 0) {
|
||||
for (var i = 0; i < optionsToShow.length; i++) {
|
||||
optionsToShow[i].style.visibility = "visible";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < optionsToShow.length; i++) {
|
||||
optionsToShow[i].style.visibility = "hidden";
|
||||
}
|
||||
}
|
||||
}
|
@ -9,6 +9,5 @@ function getURL(path) {
|
||||
if (path == undefined) {
|
||||
path = "";
|
||||
}
|
||||
console.log(window.location.href + path);
|
||||
return window.location.href + path;
|
||||
}
|
@ -2,46 +2,6 @@
|
||||
font-size: 200%;
|
||||
}
|
||||
|
||||
.dataFrame {
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
border: none;
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
.newLine {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#adminHomeButton {
|
||||
box-shadow: 0px 2px 4px;
|
||||
font-weight: bold;
|
||||
}
|
||||
#adminHomeButton:hover {
|
||||
color: black;
|
||||
background-color: rgba(255, 165, 0, .6);
|
||||
}
|
||||
#adminHomeButton:active {
|
||||
box-shadow: 0px 0px 2px;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
|
||||
|
||||
#mainHomeButton {
|
||||
box-shadow: 0px 2px 4px;
|
||||
font-weight: bold;
|
||||
}
|
||||
#mainHomeButton:hover {
|
||||
color: black;
|
||||
background-color: rgba(255, 165, 0, .6);
|
||||
}
|
||||
#mainHomeButton:active {
|
||||
box-shadow: 0px 0px 2px;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
|
||||
#notAnAdmin {
|
||||
width: 300px;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
|
@ -2,6 +2,7 @@
|
||||
width: 800px;
|
||||
margin: 0;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
|
||||
}
|
||||
|
||||
#informationContentPanel {
|
||||
@ -11,44 +12,12 @@
|
||||
padding-bottom: 15px;
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
/*box-shadow: 0px 5px 10px;*/
|
||||
}
|
||||
|
||||
#informationContentPanel h3,h4,h5 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.navPanel {
|
||||
position: relative;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 10%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.navPanel a:hover {
|
||||
color: black;
|
||||
background-color: rgba(255, 165, 0, .6);
|
||||
}
|
||||
|
||||
.navPanel a:active {
|
||||
box-shadow: 0px 0px 2px;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
|
||||
.navLink {
|
||||
border: 1px solid blue;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0px 2px 4px;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
padding: 10px;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#dbManagementPanel {
|
||||
gap: 2%;
|
||||
}
|
@ -32,6 +32,8 @@
|
||||
padding-right: 10px;
|
||||
padding-bottom: 30px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
font-size: 130%;
|
||||
}
|
||||
|
||||
#divisionsTable th {
|
||||
@ -45,12 +47,22 @@
|
||||
padding-top: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
vertical-align: middle;
|
||||
font-size: 130%;
|
||||
}
|
||||
|
||||
#informationTable tr {
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
#informationTable td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#informationTable img {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.infoTableLeftColumn {
|
||||
|
@ -1,10 +1,24 @@
|
||||
/* Line break for flex layout */
|
||||
.newLine {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#body {
|
||||
background-image: linear-gradient(to right, rgba(0, 0, 255, .8), rgba(255, 165, 0, .8));
|
||||
padding-top: 2%;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
height:100%
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
CONTENT FRAME
|
||||
|
||||
Modifies and defines the iFrame that's holding the content shown to the user
|
||||
|
||||
*/
|
||||
|
||||
#contentFrame {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -19,6 +33,7 @@
|
||||
padding-left: 50px;
|
||||
padding-right: 50px;
|
||||
padding-bottom: 40px;
|
||||
box-shadow: 0px 0px 2px;
|
||||
}
|
||||
|
||||
#contentFrame h1 {
|
||||
@ -31,7 +46,15 @@
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
|
||||
#navPanel {
|
||||
|
||||
/*
|
||||
STANDARD NAVIGATION
|
||||
|
||||
For upper/primary controls
|
||||
|
||||
*/
|
||||
|
||||
.navPanel {
|
||||
position: relative;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
@ -40,26 +63,26 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
#navPanel a:hover {
|
||||
.navPanel a:hover {
|
||||
color: black;
|
||||
background-color: rgba(255, 165, 0, .6);
|
||||
}
|
||||
|
||||
#navPanel a:active {
|
||||
box-shadow: 0px 2px 3px;
|
||||
transform: translateY(4px) translateX(2px);
|
||||
.navPanel a:active {
|
||||
box-shadow: 0px 0px 2px;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
|
||||
.navLink {
|
||||
border: 1px solid blue;
|
||||
border-radius: 3px;
|
||||
box-shadow: 2px 6px 6px;
|
||||
box-shadow: 0px 2px 4px;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
padding: 10px;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.dataFrame {
|
||||
@ -68,47 +91,74 @@
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
border: none;
|
||||
/*border-radius: 5px;
|
||||
box-shadow: 0px 10px 15px;
|
||||
background-color: rgba(183, 183, 255, 0.6);*/
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
.newLine {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/*
|
||||
SUB-NAVIGATION
|
||||
|
||||
For all the things at the bottom of the page; log in/out, 'my account', etc.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#subNav {
|
||||
.subNav {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 2%;
|
||||
padding: 5px;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
#logoutButton {
|
||||
.subNavLink {
|
||||
border: 1px solid blue;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0px 2px 4px;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
padding: 5px;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
#logoutButton:hover {
|
||||
|
||||
.subNav a {
|
||||
box-shadow: 0px 2px 4px;
|
||||
}
|
||||
.subNav a:hover {
|
||||
color: black;
|
||||
background-color: rgba(255, 165, 0, .6);
|
||||
}
|
||||
#logoutButton:active {
|
||||
.subNav a:active {
|
||||
box-shadow: 0px 0px 2px;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
|
||||
#loginButton {
|
||||
box-shadow: 0px 2px 4px;
|
||||
font-weight: bold;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
TEMPORARY
|
||||
*/
|
||||
#contentFrame h4 {
|
||||
margin: auto;
|
||||
padding-bottom: 15px;
|
||||
font-size: 250%;
|
||||
}
|
||||
#loginButton:hover {
|
||||
color: black;
|
||||
background-color: rgba(255, 165, 0, .6);
|
||||
|
||||
#giveawayLink {
|
||||
text-decoration:none;
|
||||
color:blue;
|
||||
-webkit-text-stroke: 1px white;
|
||||
}
|
||||
#loginButton:active {
|
||||
box-shadow: 0px 0px 2px;
|
||||
transform: translateY(2px);
|
||||
#giveawayLink:hover {
|
||||
color:orange;
|
||||
-webkit-text-stroke: 1px black;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user