diff --git a/admin/admin_nav.php b/admin/admin_nav.php
new file mode 100644
index 0000000..8a54c09
--- /dev/null
+++ b/admin/admin_nav.php
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+ TROJAN'S GENERAL DATA SHIT
+
+
+
+
+
USER MANAGEMENT
+
+
+
TOURNEY MANAGEMENT
+
+
+
!!!!! DANGER ZONE !!!!!
+
+
+
+
+
\ No newline at end of file
diff --git a/admin/db_config.php b/admin/db_config.php
new file mode 100644
index 0000000..75e25a7
--- /dev/null
+++ b/admin/db_config.php
@@ -0,0 +1,70 @@
+
\ No newline at end of file
diff --git a/admin/db_management/conn_check.php b/admin/db_management/conn_check.php
new file mode 100644
index 0000000..464bb46
--- /dev/null
+++ b/admin/db_management/conn_check.php
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+ TROJAN'S GENERAL DATA SHIT
+
+
+
+ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ echo "Database connection successful!
";
+ echo "If you're still having issues, talk to your system administrator, or file an issue with the package maintainer
";
+ } catch (PDOException $e) {
+ echo "Connection failed: " . $e->getMessage();
+ }
+
+ ?>
+
+
+
\ No newline at end of file
diff --git a/admin/db_management/db_management.css b/admin/db_management/db_management.css
new file mode 100644
index 0000000..37315ca
--- /dev/null
+++ b/admin/db_management/db_management.css
@@ -0,0 +1,38 @@
+#warningPanel h1,h2,h3,h4,h5,h6 {
+ text-align: center;
+}
+
+#confirmButton {
+ position: relative;
+ flex-wrap: wrap;
+ display: flex;
+ justify-content: center;
+ font-weight: bold;
+ border: 1px solid blue;
+ border-radius: 3px;
+ box-shadow: 0px 2px 4px;
+ text-decoration: none;
+ color: black;
+ width: 100px;
+ padding: 10px;
+ padding-left: 30px;
+ padding-right: 30px;
+ margin: auto;
+}
+
+#confirmButton:hover {
+ color: black;
+ background-color: rgba(255, 165, 0, .6);
+}
+
+#confirmButton:active {
+ box-shadow: 0px 0px 2px;
+ transform: translateY(2px);
+}
+
+.sqlOutput {
+ border: 1px solid black;
+ border-radius: 5px;
+ width: 400px;
+ padding: 5px;
+}
\ No newline at end of file
diff --git a/admin/db_management/initialize.php b/admin/db_management/initialize.php
new file mode 100644
index 0000000..534e24a
--- /dev/null
+++ b/admin/db_management/initialize.php
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+ no title
+
+
+
+ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ echo "Connected successfully
";
+ } catch (PDOException $e) { // failed connection
+ echo "Connection failed: " . $e->getMessage();
+ }
+
+ // Check if the users table exists already
+ $sqlCheckUserTable = $conn->prepare("SHOW TABLES LIKE '" . $userTableName . "'");
+
+ // Run the query
+ $sqlCheckUserTable->execute();
+
+ //Check if any rows exist - if not, create the table, if yes, destroy it first, then create it
+ $count = $sqlCheckUserTable->rowCount();
+
+ if ($count != 0) {
+ echo "Deleting exsiting table '" . $userTableName . "'...
";
+ // Create the query to drop the table
+ $sqlDropUserTable = "DROP TABLE " . $userTableName;
+ $conn->exec($sqlDropUserTable); // drop the table
+ echo "Deleted!
Creating new table '" . $userTableName . "'...
";
+ try { // Create the new table
+ $conn->query($sqlCreateUserTable);
+ echo "Table '" . $userTableName . "' successfully created (user data)
";
+ } catch (PDOException $e) {
+ echo $sqlCreateUserTable . " " . $e->getMessage();
+ }
+ } else { // If the table doesn't already exist, we'll just create it
+ try {
+ $conn->query($sqlCreateUserTable);
+ echo "Table '" . $userTableName . "' successfully created (user data)
";
+ } catch (PDOException $e) {
+ echo $sqlCreateUserTable . " " . $e->getMessage();
+ }
+ }
+
+ // Check if the users table exists already
+ $sqlCheckDataTable = $conn->prepare("SHOW TABLES LIKE '" . $dataTableName . "'");
+
+ // Run the query
+ $sqlCheckDataTable->execute();
+
+ //Check if any rows exist - if not, create the table, if yes, destroy it first, then create it
+ $count = $sqlCheckDataTable->rowCount();
+
+ if ($count != 0) {
+ echo "Deleting exsiting table '" . $dataTableName . "'...
";
+ // Create the query to drop the table
+ $sqlDropDataTable = "DROP TABLE " . $dataTableName;
+ $conn->exec($sqlDropDataTable); // drop the table
+ echo "Deleted!
Creating new table '" . $dataTableName . "'...
";
+ try { // Create the new table
+ $conn->query($sqlCreateDataTable);
+ echo "Table '" . $dataTableName . "' successfully created (replay data)
";
+ } catch (PDOException $e) {
+ echo $sqlCreateDataTable . " " . $e->getMessage();
+ }
+ } else { // If the table doesn't already exist, we'll just create it
+ try {
+ $conn->query($sqlCreateDataTable);
+ echo "Table '" . $dataTableName . "' successfully created (replay data)
";
+ } catch (PDOException $e) {
+ echo $sqlCreateDataTable . " " . $e->getMessage();
+ }
+ }
+
+ $conn = null; // Close the connection
+
+ // Tell the use we're done
+ echo "DONE!
";
+
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/admin/db_management/reinitialize.php b/admin/db_management/reinitialize.php
new file mode 100644
index 0000000..d0815cd
--- /dev/null
+++ b/admin/db_management/reinitialize.php
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+ TROJAN'S GENERAL DATA SHIT
+
+
+
+
+
DATABASE RE-INITIALIZATION
+
+
+
THIS IS VERY DANGEROUS
+
ONLY CLICK THE BUTTON IF YOU ARE
+
ABSOLUTELY 100% SURE YOU WANT TO
+
DO THIS. THIS WILL DELETE ABSOLUTELY
+
EVERYTHING ON THIS SERVER, EXCEPT
+
FOR ADMIN ACCOUNTS.
+
+
+
ARE YOU ABSOLUTELY SURE?!
+
YES
+
+
+
+
\ No newline at end of file
diff --git a/admin/index.html b/admin/index.html
deleted file mode 100644
index 00f841a..0000000
--- a/admin/index.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
- Trojan's Trophy Room
-
-
-
-
-
Trojan's Trophy Room
-
Choose a division to see results!
-
-
-
-
-
-
\ No newline at end of file
diff --git a/admin/index.php b/admin/index.php
new file mode 100644
index 0000000..ed02d62
--- /dev/null
+++ b/admin/index.php
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+ ADMIN PANEL - Trojan's Trophy Room
+
+
+
+
+
Trojan's Trophy Room
+
+
+
+
+
+
\ No newline at end of file
diff --git a/admin/user_management/add_user.php b/admin/user_management/add_user.php
new file mode 100644
index 0000000..22d271e
--- /dev/null
+++ b/admin/user_management/add_user.php
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+ no title
+
+
+
+ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ echo "Connected successfully
";
+
+
+ // Variables for the various input fields
+ $username = $_POST["username"];
+ $password = password_hash($_POST["password"], PASSWORD_DEFAULT);
+ $discord = $_POST["discord"];
+ $twitch = $_POST["twitch"];
+ $youtube = $_POST["youtube"];
+
+ if ($_POST["isAdmin"] == NULL) {
+ $isAdmin = 0;
+ } else {
+ $isAdmin = 1;
+ }
+
+ echo " ";
+ echo $username . " ";
+ echo $password . " ";
+ echo $discord . " ";
+ echo $twitch . " ";
+ echo $youtube . " ";
+
+ echo $isAdmin . " ";
+ echo "lock 0";
+
+ $insert = $conn->prepare("INSERT INTO users (username, password, discord, twitch, youtube, isAdmin) VALUES (:username, :password, :discord, :twitch, :youtube, :isAdmin)");
+
+ echo "lock 1";
+
+ $insert->bindParam(":username", $username);
+ $insert->bindParam(":password", $password);
+ $insert->bindParam(":discord", $discord);
+ $insert->bindParam(":twitch", $twitch);
+ $insert->bindParam(":youtube", $youtube);
+ echo "lock 2";
+
+ $insert->bindParam(":isAdmin", $isAdmin);
+
+ echo "lock 3";
+
+ $insert->execute();
+ echo "New records created successfully?";
+
+
+
+
+
+ } catch (PDOException $e) { // failed connection
+ echo "Connection failed: " . $e->getMessage();
+ }
+
+ $conn = null;
+
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/admin/user_management/user_form.php b/admin/user_management/user_form.php
new file mode 100644
index 0000000..fab26a7
--- /dev/null
+++ b/admin/user_management/user_form.php
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+ USER CREATION FORM
+
+
+
+
+
+
\ No newline at end of file
diff --git a/admin/user_management/user_management.css b/admin/user_management/user_management.css
new file mode 100644
index 0000000..22021da
--- /dev/null
+++ b/admin/user_management/user_management.css
@@ -0,0 +1,149 @@
+#confirmButton {
+ position: relative;
+ flex-wrap: wrap;
+ display: flex;
+ justify-content: center;
+ font-weight: bold;
+ border: 1px solid blue;
+ border-radius: 3px;
+ box-shadow: 0px 2px 4px;
+ text-decoration: none;
+ color: black;
+ width: 100px;
+ padding: 10px;
+ padding-left: 30px;
+ padding-right: 30px;
+ margin: auto;
+}
+
+#confirmButton:hover {
+ color: black;
+ background-color: rgba(255, 165, 0, .6);
+}
+
+#confirmButton:active {
+ box-shadow: 0px 0px 2px;
+ transform: translateY(2px);
+}
+
+.sqlOutput {
+ border: 1px solid black;
+ border-radius: 5px;
+ width: 400px;
+ padding: 5px;
+}
+
+#userFormPanel {
+ width: 500px;
+}
+
+#userFormPanel {
+ margin: auto;
+ text-align: center;
+}
+
+
+#inputArea {
+ display: flex;
+ flex-wrap: wrap;
+ flex-direction: column;
+ margin: auto;
+}
+
+#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"] {
+ border-radius: 2px;
+ width: 150px;
+ padding: 7px 10px;
+ margin: 1% 6%;
+}
+
+#userForm input[type="password"] {
+ border-radius: 2px;
+ width: 150px;
+ padding: 7px 10px;
+ margin: 1% 6%;
+}
+
+#passwordOptions {
+ display: flex;
+ flex-wrap: wrap;
+ flex-direction: row;
+ margin: auto;
+}
+#passwordOptions h4 {
+ text-align: center;
+ margin: auto;
+}
+#extraOptions {
+ display: flex;
+ flex-wrap: wrap;
+ flex-direction: row;
+ margin: auto;
+}
+#extraOptions h4 {
+ text-align: center;
+ margin: auto;
+}
+#extraOptions p {
+ text-align: left;
+ margin: auto;
+}
+
+.passwordOptions {
+ display: flex;
+ flex-wrap: wrap;
+ text-align: center;
+ flex-direction: row;
+ font-size: 100%;
+ font-weight: normal;
+ padding: 0 20px;
+}
+
+
+.extraOptions {
+ display: flex;
+ flex-wrap: wrap;
+ text-align: center;
+ flex-direction: row;
+ font-size: 100%;
+ font-weight: normal;
+ padding: 0 20px;
+}
+
+
+
+.newLine {
+ width: 100%;
+}
diff --git a/admin/user_management/user_management.js b/admin/user_management/user_management.js
new file mode 100644
index 0000000..3c0d18d
--- /dev/null
+++ b/admin/user_management/user_management.js
@@ -0,0 +1,92 @@
+function randomPassword() {
+ // Grab the length of password the user wants
+ var passwordLength = document.getElementById("passwordLength").value;
+ var password = "";
+
+ // The character set of the password. Modify this at your discretion
+ var charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
+
+ // Get random characters until we're at the desired length
+ for (var i = 0; i < passwordLength; i++) {
+ password += charset.charAt(Math.floor(Math.random() * charset.length));
+ }
+
+ // Set the password field to what we've generated
+ document.getElementById("password").value = password;
+}
+
+function togglePassword() {
+ // This function features various 'toggles' for the checkboxes on the manual user creation screen
+
+ // Check if the 'no password' option is checked.
+ // A password can be set later, if necessary
+
+ if (document.getElementById("none").checked) { // IF WE HAVE NO PASSWORD OPTION CHECKED
+ var enabled = true; // enabled variable status set false
+ // Disable all the checkboxes and password length inputs
+ document.getElementById("password").disabled = true;
+ document.getElementById("showPassword").disabled = true;
+ document.getElementById("random").disabled = true;
+ document.getElementById("passwordLength").disabled = true;
+ // Uncheck the random password mark
+ document.getElementById("random").checked = false;
+ } else if (!(document.getElementById("none").checked)) { // IF WE UNCHECK THE OPTION, RE-ENABLE EVERYTHING
+ var enabled = false; // enabled variable set true!
+ // Re-enable inputs
+ document.getElementById("password").disabled = false;
+ document.getElementById("showPassword").disabled = false;
+ document.getElementById("random").disabled = false;
+ document.getElementById("passwordLength").disabled = false;
+ }
+
+ // This will check to see if we want the password visible, and sets it as such
+ if (document.getElementById("showPassword").checked && !enabled) {
+ document.getElementById("password").type = "text";
+ } else if (!(document.getElementById("showPassword").checked) && !enabled) {
+ document.getElementById("password").type = "password";
+ }
+
+ // This will remove the password from the field when 'random' is unchecked
+ if (!(document.getElementById("random").checked) && enabled) {
+ document.getElementById("password").value = "";
+ }
+
+}
+
+function forcePassword() {
+ // This function forces the use of a password when we try to make the user an administrator
+ // An admin without a password could be bad news....
+
+ if (document.getElementById("isAdmin").checked) { // ensure the box is checked
+ document.getElementById("none").checked = false; // Force-uncheck the 'none' option
+ togglePassword(); // Generate a password
+ document.getElementById("none").disabled = true; // Disable the 'none' option
+ } else {
+ document.getElementById("none").disabled = false; // Re-enable the 'none' option
+ }
+}
+
+function verifyInput() {
+ // This function ensures that the form was filled out properly.
+ // It seems way easier to do this through JS than PHP but I could be wrong
+
+ // Check if the username is filled out
+ var username = document.forms["userForm"]["username"].value;
+ if (username == "") {
+ alert ("Must enter a username!");
+ return false;
+ }
+
+ // Check if a password is required, if so, make sure one is entered
+ var password = document.forms["userForm"]["password"].value;
+ if (!(document.getElementById("none").checked) && password == "") {
+ alert ("Must enter a password! Or select \"None\" for no password (not available for administrator accounts).");
+ return false;
+ }
+
+ // Ensure the password (if enabled) is at least 6 characters in length
+ if (!(document.getElementById("none").checked) && password.length < 6) {
+ alert ("Password must have a minimum length of 6 characters.");
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/scripts/trojan.js b/scripts/trojan.js
index 51806d4..5284c8a 100644
--- a/scripts/trojan.js
+++ b/scripts/trojan.js
@@ -1,5 +1,6 @@
function resizeIframe(obj) {
+ obj.style.height = "200px";
+ obj.style.width = "100px";
obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
obj.style.width = obj.contentWindow.document.documentElement.scrollWidth + 'px';
- console.log (obj.style.width);
}
\ No newline at end of file
diff --git a/styles/admin.css b/styles/admin.css
new file mode 100644
index 0000000..03a3dc7
--- /dev/null
+++ b/styles/admin.css
@@ -0,0 +1,83 @@
+#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%
+}
+
+#contentFrame {
+ display: flex;
+ flex-direction: column;
+ margin: auto;
+ border: 1px solid black;
+ border-radius: 5px;
+ background-color: rgba(255, 255, 255, .2);
+ width:80%;
+ max-width: 900px;
+ min-height: 0px;
+ padding-top: 20px;
+ padding-left: 50px;
+ padding-right: 50px;
+ padding-bottom: 40px;
+}
+
+#contentFrame h1 {
+ margin: auto;
+ padding-bottom: 20px;
+}
+
+#contentFrame h2,h3 {
+ margin: auto;
+ padding-bottom: 30px;
+}
+
+#adminHeader {
+ 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);
+}
+
+#subNav {
+ display: flex;
+ flex-direction: row;
+ gap: 1%;
+ justify-content: center;
+ gap: 2%;
+}
+
+#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);
+}
\ No newline at end of file
diff --git a/styles/admin_nav.css b/styles/admin_nav.css
new file mode 100644
index 0000000..fa8f4ad
--- /dev/null
+++ b/styles/admin_nav.css
@@ -0,0 +1,53 @@
+#generalBody {
+ width: 800px;
+ margin: 0;
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
+}
+
+#informationContentPanel {
+ margin: auto;
+ padding-left: 10px;
+ padding-right: 10px;
+ 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;
+}
+
+#dbManagementPanel {
+ gap: 2%;
+}
\ No newline at end of file
diff --git a/styles/data.css b/styles/data.css
index 63d6d1b..5281e83 100644
--- a/styles/data.css
+++ b/styles/data.css
@@ -5,7 +5,7 @@
}
#leaderBody {
- width: 400px;
+ width: 300px;
margin: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
diff --git a/styles/primary.css b/styles/primary.css
index 492fbaa..ff5968f 100644
--- a/styles/primary.css
+++ b/styles/primary.css
@@ -12,7 +12,8 @@
border: 1px solid black;
border-radius: 5px;
background-color: rgba(255, 255, 255, .2);
- width: 800px;
+ width:80%;
+ max-width: 900px;
min-height: 0px;
padding-top: 20px;
padding-left: 50px;
@@ -36,6 +37,7 @@
display: flex;
justify-content: center;
gap: 10%;
+ font-weight: bold;
}
@@ -69,6 +71,7 @@
border-radius: 5px;
box-shadow: 0px 10px 15px;
background-color: rgba(183, 183, 255, 0.6);
+ max-width: 90%;
}
.newLine {