diff --git a/.htaccess b/.htaccess index bcfd75c..fc3a283 100644 --- a/.htaccess +++ b/.htaccess @@ -2,4 +2,4 @@ RewriteEngine on RewriteRule ^/?user/([a-zA-Z0-9\-\_]+)$ /user/user.php?username=$1 [L,NC] -RewriteRule ^/?tournament/([0-9]+)$ /tournament/tourney.php?tourneyID=$1 [L,NC] +RewriteRule ^/?tournament/([a-zA-Z0-9]+)$ /tournament/tournament.php?tournamentUID=$1 [L,NC] diff --git a/admin/data_management/add_game.php b/admin/data_management/add_game.php index 5c39063..14fd9d8 100644 --- a/admin/data_management/add_game.php +++ b/admin/data_management/add_game.php @@ -102,10 +102,12 @@ list($urlPathBlank, $replaysPath, $ballchasingID) = explode("/", $ballchasingPath); } - + // Create a unique ID for the game + $gameUID = uniqid(rand()); // SQL Query to insert data $insert = $conn->prepare("INSERT INTO " . $gameDataTableName . " ( + gameUID, gameName, gameDate, uploadedBy, @@ -128,6 +130,7 @@ ballchasingID, notes ) VALUES ( + :gameUID, :gameName, :gameDate, :uploadedBy, @@ -153,6 +156,7 @@ // Assign variables to SQL command/preparation + $insert->bindValue(":gameUID", $gameUID); $insert->bindValue(":gameName", $gameName); $insert->bindValue(":gameDate", $gameDate); $insert->bindValue(":uploadedBy", $uploadedBy); diff --git a/admin/data_management/add_tourney.php b/admin/data_management/add_tourney.php index 8f63443..499fa4d 100644 --- a/admin/data_management/add_tourney.php +++ b/admin/data_management/add_tourney.php @@ -54,8 +54,12 @@ $winningTeamName = $_POST["winningTeamName"]; $notes = $_POST["notes"]; + // Create a unique ID for the tournament + $tourneyUID = uniqid(rand()); + echo "

$tourneyName

"; echo "

$tourneyDate

"; + echo "

$tourneyUID

"; echo "

$division

"; echo "

$numPlayers

"; echo "

$bestOf

"; @@ -68,6 +72,7 @@ $insert = $conn->prepare("INSERT INTO " . $tournamentDataTableName . " ( + tournamentUID, tournamentName, tournamentDate, tournamentDivision, @@ -80,6 +85,7 @@ winner4, notes ) VALUES ( + :tournamentUID, :tournamentName, :tournamentDate, :tournamentDivision, @@ -94,6 +100,7 @@ )"); + $insert->bindValue(":tournamentUID", $tourneyUID); $insert->bindValue(":tournamentName", $tourneyName); $insert->bindValue(":tournamentDate", $tourneyDate); $insert->bindValue(":tournamentDivision", $division); diff --git a/admin/db_config.php b/admin/db_config.php index ea7d7c5..9c0d650 100644 --- a/admin/db_config.php +++ b/admin/db_config.php @@ -78,6 +78,7 @@ userUpdated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP $sqlCreateDataTable = " CREATE TABLE " . $gameDataTableName . " ( gameID INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, +gameUID VARCHAR(40), gameName VARCHAR(100), gameDate DATE, uploadedBy VARCHAR(30), @@ -108,6 +109,7 @@ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP $sqlCreateTournamentTable = " CREATE TABLE " . $tournamentDataTableName . " ( tournamentID INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, +tournamentUID VARCHAR(40), tournamentName VARCHAR(150), tournamentDate DATE, tournamentDivision VARCHAR(20), diff --git a/styles/tourney_display.css b/styles/tourney_display.css new file mode 100644 index 0000000..e94a2ee --- /dev/null +++ b/styles/tourney_display.css @@ -0,0 +1,13 @@ +#tournamentDisplay { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + border: 1px solid black; + border-radius: 7px; + width: 80%; + margin: auto; +} + +/*// MOBILE //// +///////////////*/ \ No newline at end of file diff --git a/tournament/tournament.php b/tournament/tournament.php new file mode 100644 index 0000000..adc50d8 --- /dev/null +++ b/tournament/tournament.php @@ -0,0 +1,124 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + // Get the division from the page + $tourneyUID = $_GET["tournamentUID"]; + + // If we want all the data, we don't need to select a division in the SQL query + $sqlGetTourneyInfo = $conn->prepare("SELECT * FROM " . $tournamentDataTableName . " WHERE tournamentUID='" . $tourneyUID . "'"); + + $sqlGetTourneyInfo->execute(); + +} catch (PDOException $e) { // failed connection + echo "Connection failed: " . $e->getMessage(); +} + +$tourneyResults = $sqlGetTourneyInfo->fetch(PDO::FETCH_ASSOC); + +$tourneyExists = false; +if (isset($tourneyResults)) { + if (mb_strtolower($_GET["tournamentUID"]) == mb_strtolower($tourneyResults["tournamentUID"])) { + $tourneyExists = true; + } +} +?> + + + + + + + + + + + + Tournament Details + + + + +
+ Rocket League logo for background +
+
+ Trojan Destiny logo +
+
+

TrojanDestinyRL

+
youtube logo
+
twitch logo
+
discord logo
+
+
+ Trojan Destiny logo +
+
+

+
+ format('M j, Y'); + + echo ("THIS TOURNAMENT EXISTS - DETAILS COMING"); + } else { + echo "
"; + echo "

TOURNAMENT NOT FOUND!

"; + echo "

Double-check your link.

"; + echo "

Sorry!

"; + echo "

 

"; + echo "
"; + } + ?> +
+

+ +
+ + + + \ No newline at end of file