BIG UPDATE
- Added admin panel - Added user creation form - Now connects to SQL - Added option for DB (re)initialization - Capable of writing user form to SQL
This commit is contained in:
parent
2344bac200
commit
4db53fbe75
39
admin/admin_nav.php
Normal file
39
admin/admin_nav.php
Normal file
@ -0,0 +1,39 @@
|
||||
<!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/admin.css" />
|
||||
<link rel="stylesheet" href="../styles/admin_nav.css" />
|
||||
<!-- <script src="trojan.js"></script>-->
|
||||
<title>TROJAN'S GENERAL DATA SHIT</title>
|
||||
</head>
|
||||
|
||||
<body id="generalBody">
|
||||
<div id="informationContentPanel">
|
||||
<h3>USER MANAGEMENT</h3>
|
||||
<div class="navPanel" id="userManagementPanel">
|
||||
<a href="user_management/user_form.php" target="dataFrame" class="navLink">CREATE USER</a>
|
||||
<a href="#" target="dataFrame" class="navLink">MODIFY USER</a>
|
||||
<a href="#" target="dataFrame" class="navLink">DISPLAY ALL USERS</a>
|
||||
</div>
|
||||
<p> </p>
|
||||
<h3>TOURNEY 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="#" target="dataFrame" class="navLink">THREE</a>
|
||||
</div>
|
||||
<p> </p>
|
||||
<h3>!!!!! DANGER ZONE !!!!!</h3>
|
||||
<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">FOUR</a>
|
||||
</div>
|
||||
<p> </p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
70
admin/db_config.php
Normal file
70
admin/db_config.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
// DB LOGIN DETAILS HERE
|
||||
|
||||
$servername = "127.0.0.1";
|
||||
$username = "USERNAME";
|
||||
$password = "PASSWORD";
|
||||
$dbName = "DBNAME";
|
||||
|
||||
|
||||
/*////// USER-CONFIGURABLE VARIABLES HERE /////////
|
||||
|
||||
I don't recommend you change these, but if you
|
||||
know what you're doing, have at 'er
|
||||
|
||||
/////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
$userTableName = "users"; // name of the table containing user data
|
||||
$dataTableName = "replays"; // table containing replay data
|
||||
|
||||
$passwordLength = 8; // default minimum random password length
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/*/////// DATABASE-IMPORTANT STUFF /////////
|
||||
|
||||
!!!! WARNING !!!!
|
||||
DO NOT EDIT THE FOLLOWING UNLESS YOU ARE
|
||||
ABSOLUTELY CERTAIN OF WHAT YOU ARE DOING
|
||||
|
||||
////////////////////////////////////////////*/
|
||||
|
||||
// USER DATA TABLE
|
||||
$sqlCreateUserTable = "
|
||||
CREATE TABLE " . $userTableName . " (
|
||||
userID INT(8) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
isAdmin BOOL,
|
||||
username VARCHAR(30) NOT NULL,
|
||||
password VARCHAR(255),
|
||||
discord VARCHAR(50),
|
||||
twitch VARCHAR(50),
|
||||
youtube VARCHAR(50),
|
||||
userCreated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
userUpdated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
)";
|
||||
|
||||
|
||||
// REPLAYS DATA TABLE
|
||||
$sqlCreateDataTable = "
|
||||
CREATE TABLE " . $dataTableName . " (
|
||||
replayID INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
ballchasingID VARCHAR(100) NOT NULL,
|
||||
replayName VARCHAR(150) NOT NULL,
|
||||
uploadedBy VARCHAR(30),
|
||||
numPlayers TINYINT UNSIGNED NOT NULL,
|
||||
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)
|
||||
)";
|
||||
?>
|
31
admin/db_management/conn_check.php
Normal file
31
admin/db_management/conn_check.php
Normal file
@ -0,0 +1,31 @@
|
||||
<!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.css" />
|
||||
<!-- <script src="trojan.js"></script>-->
|
||||
<title>TROJAN'S GENERAL DATA SHIT</title>
|
||||
</head>
|
||||
|
||||
<body class="sqlOutput">
|
||||
<?php
|
||||
|
||||
include("../dev_db_config.php"); // Include credentials
|
||||
|
||||
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>Database connection successful!</p>";
|
||||
echo "<p>If you're still having issues, talk to your system administrator, or file an issue with the package maintainer</p>";
|
||||
} catch (PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
38
admin/db_management/db_management.css
Normal file
38
admin/db_management/db_management.css
Normal file
@ -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;
|
||||
}
|
97
admin/db_management/initialize.php
Normal file
97
admin/db_management/initialize.php
Normal file
@ -0,0 +1,97 @@
|
||||
<!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.css" />
|
||||
<!-- <script src="trojan.js"></script>-->
|
||||
<title>no title</title>
|
||||
</head>
|
||||
|
||||
<body class="sqlOutput">
|
||||
<?php
|
||||
// USER-DEFINED VARIABLES
|
||||
include("../dev_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>";
|
||||
} 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 "<p>Deleting exsiting table '" . $userTableName . "'...</p>";
|
||||
// Create the query to drop the table
|
||||
$sqlDropUserTable = "DROP TABLE " . $userTableName;
|
||||
$conn->exec($sqlDropUserTable); // drop the table
|
||||
echo "<p>Deleted!</p><p>Creating new table '" . $userTableName . "'...</p>";
|
||||
try { // Create the new table
|
||||
$conn->query($sqlCreateUserTable);
|
||||
echo "<p>Table '" . $userTableName . "' successfully created (user data)</p>";
|
||||
} catch (PDOException $e) {
|
||||
echo $sqlCreateUserTable . "<br>" . $e->getMessage();
|
||||
}
|
||||
} else { // If the table doesn't already exist, we'll just create it
|
||||
try {
|
||||
$conn->query($sqlCreateUserTable);
|
||||
echo "<p>Table '" . $userTableName . "' successfully created (user data)</p>";
|
||||
} catch (PDOException $e) {
|
||||
echo $sqlCreateUserTable . "<br>" . $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 "<p>Deleting exsiting table '" . $dataTableName . "'...</p>";
|
||||
// Create the query to drop the table
|
||||
$sqlDropDataTable = "DROP TABLE " . $dataTableName;
|
||||
$conn->exec($sqlDropDataTable); // drop the table
|
||||
echo "<p>Deleted!</p><p>Creating new table '" . $dataTableName . "'...</p>";
|
||||
try { // Create the new table
|
||||
$conn->query($sqlCreateDataTable);
|
||||
echo "<p>Table '" . $dataTableName . "' successfully created (replay 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>";
|
||||
} catch (PDOException $e) {
|
||||
echo $sqlCreateDataTable . "<br>" . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
$conn = null; // Close the connection
|
||||
|
||||
// Tell the use we're done
|
||||
echo "<p style=\"font-weight:bold\">DONE!</p>";
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
32
admin/db_management/reinitialize.php
Normal file
32
admin/db_management/reinitialize.php
Normal file
@ -0,0 +1,32 @@
|
||||
<!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/admin.css" />
|
||||
<link rel="stylesheet" href="../../styles/admin_nav.css" />
|
||||
<link rel="stylesheet" href="db_management.css" />
|
||||
<!-- <script src="trojan.js"></script>-->
|
||||
<title>TROJAN'S GENERAL DATA SHIT</title>
|
||||
</head>
|
||||
|
||||
<body id="generalBody">
|
||||
<div id="warningPanel">
|
||||
<h2>DATABASE RE-INITIALIZATION</h2>
|
||||
<hr>
|
||||
<p></p>
|
||||
<h3>THIS IS VERY DANGEROUS</h3>
|
||||
<h4>ONLY CLICK THE BUTTON IF YOU ARE</h4>
|
||||
<h4>ABSOLUTELY 100% SURE YOU WANT TO</h4>
|
||||
<h4>DO THIS. THIS WILL DELETE ABSOLUTELY</h4>
|
||||
<h4>EVERYTHING ON THIS SERVER, EXCEPT</h4>
|
||||
<h4>FOR ADMIN ACCOUNTS.</h4>
|
||||
<p></p>
|
||||
<hr>
|
||||
<h2>ARE YOU ABSOLUTELY SURE?!</h2>
|
||||
<a href="initialize.php" target="dataFrame" class="navLink" id="confirmButton">YES</a>
|
||||
<p> </p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,27 +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" />
|
||||
<script src="../scripts/trojan.js"></script>
|
||||
<title>Trojan's Trophy Room</title>
|
||||
</head>
|
||||
|
||||
<body id="body">
|
||||
<div id="contentFrame">
|
||||
<h1>Trojan's Trophy Room</h1>
|
||||
<h3>Choose a division to see results!</h3>
|
||||
<div id="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>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
24
admin/index.php
Normal file
24
admin/index.php
Normal file
@ -0,0 +1,24 @@
|
||||
<!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/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>
|
||||
|
||||
<body id="body">
|
||||
<div id="contentFrame">
|
||||
<h1>Trojan's Trophy Room</h1>
|
||||
<h2 id="adminHeader">ADMIN PANEL</h2>
|
||||
<iframe src="admin_nav.php" name="dataFrame" class="dataFrame" id="dataFrame" onload="resizeIframe(this);"></iframe>
|
||||
<div id="subNav">
|
||||
<a href="./" class="navLink" id="adminHomeButton">ADMIN HOME</a>
|
||||
<a href="../" class="navLink" id="mainHomeButton">MAIN HOME</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
86
admin/user_management/add_user.php
Normal file
86
admin/user_management/add_user.php
Normal file
@ -0,0 +1,86 @@
|
||||
<!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.css" />
|
||||
<!-- <script src="trojan.js"></script>-->
|
||||
<title>no title</title>
|
||||
</head>
|
||||
|
||||
<body class="sqlOutput">
|
||||
<?php
|
||||
/////
|
||||
ini_set('display_startup_errors', 1);
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(-1);
|
||||
|
||||
// USER-DEFINED VARIABLES
|
||||
include("../dev_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>";
|
||||
|
||||
|
||||
// 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 "<br>";
|
||||
echo $username . "<br>";
|
||||
echo $password . "<br>";
|
||||
echo $discord . "<br>";
|
||||
echo $twitch . "<br>";
|
||||
echo $youtube . "<br>";
|
||||
|
||||
echo $isAdmin . "<br>";
|
||||
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;
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
67
admin/user_management/user_form.php
Normal file
67
admin/user_management/user_form.php
Normal file
@ -0,0 +1,67 @@
|
||||
<!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/admin.css" />
|
||||
<link rel="stylesheet" href="../../styles/admin_nav.css" />
|
||||
<link rel="stylesheet" href="user_management.css" />
|
||||
<?php include ("../db_config.php");?> <!-- Our password-length variable is stored here -->
|
||||
<script src="user_management.js"></script>
|
||||
<title>USER CREATION FORM</title>
|
||||
</head>
|
||||
|
||||
<body id="generalBody">
|
||||
<div id="userFormPanel">
|
||||
<h2>USER CREATION</h2>
|
||||
<p>This form is used to manually add new users to the system</p>
|
||||
<hr>
|
||||
<p></p>
|
||||
<form id="userForm" action="add_user.php" onsubmit="return verifyInput()" method="POST" target="dataFrame">
|
||||
<!-- THIS DIV IS FOR INPUT -->
|
||||
<div id="inputArea">
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" id="username" name="username" />
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" name="password" />
|
||||
<label for="discord">Discord:</label>
|
||||
<input type="text" id="discord" name="discord" />
|
||||
<label for="twitch">Twitch:</label>
|
||||
<input type="text" id="twitch" name="twitch" />
|
||||
<label for="youtube">Youtube:</label>
|
||||
<input type="text" id="youtube" name="youtube" />
|
||||
</div>
|
||||
<hr>
|
||||
<!-- THIS DIV IS FOR PASSWORD SETTINGS -->
|
||||
<div id="passwordOptions">
|
||||
<h4>PASSWORD OPTIONS</h4>
|
||||
<p class="newLine"></p>
|
||||
<input type="checkbox" id="showPassword" name="showPassword" class="passwordOptions" onclick="togglePassword()"/>
|
||||
<label for="showPassword" class="passwordOptions">Show Password</label>
|
||||
<p class="newLine"></p>
|
||||
<input type="checkbox" id="random" name="random" class="passwordOptions" onclick="randomPassword();togglePassword();"/>
|
||||
<label for="random" class="passwordOptions">Random</label>
|
||||
<label for="passwordLength">Length of password: </label>
|
||||
<input type="number" id="passwordLength" value="<?php echo $passwordLength ?>" min="6" max="20" onchange="randomPassword();togglePassword();">
|
||||
<p class="newLine"></p>
|
||||
<input type="checkbox" id="none" name="none" class="passwordOptions" onclick="togglePassword()"/>
|
||||
<label for="none" class="passwordOptions">None (can be set later)</label>
|
||||
</div>
|
||||
<hr>
|
||||
<!-- THIS DIV IS FOR EXTRA SETTINGS -->
|
||||
<div id="extraOptions">
|
||||
<h4>EXTRA OPTIONS</h4>
|
||||
<p class="newLine"> </p>
|
||||
<input type="checkbox" id="isAdmin" name="isAdmin" class="extraOptions" onclick="forcePassword()">
|
||||
<label for="isAdmin" class="extraOptions">Make administrator?</label>
|
||||
<p class="newLine">An administrator will have FULL access to the administrator panel. In the hands of the wrong user, THIS COULD CAUSE SERIOUS DAMAGE AND IRREPARABLE HARM TO YOUR SERVER! Proceed with caution, and only with those you trust.</p>
|
||||
<p class="newLine"></p>
|
||||
</div>
|
||||
<p> </p>
|
||||
<input type="submit" value="CREATE" />
|
||||
</form>
|
||||
<p> </p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
149
admin/user_management/user_management.css
Normal file
149
admin/user_management/user_management.css
Normal file
@ -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%;
|
||||
}
|
92
admin/user_management/user_management.js
Normal file
92
admin/user_management/user_management.js
Normal file
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
83
styles/admin.css
Normal file
83
styles/admin.css
Normal file
@ -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);
|
||||
}
|
53
styles/admin_nav.css
Normal file
53
styles/admin_nav.css
Normal file
@ -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%;
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
}
|
||||
|
||||
#leaderBody {
|
||||
width: 400px;
|
||||
width: 300px;
|
||||
margin: 0;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user