Added user editing page
Changed some layouts Probably some other things I've forgotten about lol
This commit is contained in:
parent
324bdf1fe3
commit
11572a7ade
@ -27,7 +27,8 @@
|
|||||||
<div id="informationContentPanel">
|
<div id="informationContentPanel">
|
||||||
<h3>USER MANAGEMENT</h3>
|
<h3>USER MANAGEMENT</h3>
|
||||||
<div class="navPanel" id="userManagementPanel">
|
<div class="navPanel" id="userManagementPanel">
|
||||||
<a href="user_management/user_form.php" target="dataFrame" class="navLink">CREATE USER</a>
|
<a href="user_management/user_form.php" target="dataFrame" class="navLink">CREATE USER</a>
|
||||||
|
<a href="user_management/user_edit_frame.php" target="dataFrame" class="navLink">EDIT USER</a>
|
||||||
<!-- <a href="user_management/create_safe_admin.php" target="dataFrame" class="navLink">CREATE PERMA-ADMIN</a> -->
|
<!-- <a href="user_management/create_safe_admin.php" target="dataFrame" class="navLink">CREATE PERMA-ADMIN</a> -->
|
||||||
</div>
|
</div>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
@ -61,11 +61,11 @@ try { // Try opening the SQL database connection
|
|||||||
<link rel="stylesheet" href="/styles/admin_nav.css" />
|
<link rel="stylesheet" href="/styles/admin_nav.css" />
|
||||||
<link rel="stylesheet" href="/styles/tourney_management.css" />
|
<link rel="stylesheet" href="/styles/tourney_management.css" />
|
||||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
|
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
|
||||||
|
<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>
|
||||||
<script src="/scripts/tourney_management.js"></script>
|
<script src="/scripts/tourney_management.js"></script>
|
||||||
<script src="/scripts/tools.js"></script>
|
<script src="/scripts/tools.js"></script>
|
||||||
<script>verifyPageInFrame()</script>
|
<script>verifyPageInFrame()</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>
|
|
||||||
<script>
|
<script>
|
||||||
if (parent.window.screen.width >= 360 && window.screen.width <= 1024) {
|
if (parent.window.screen.width >= 360 && window.screen.width <= 1024) {
|
||||||
// If mobile, get the mobile version
|
// If mobile, get the mobile version
|
||||||
|
@ -56,9 +56,17 @@
|
|||||||
|
|
||||||
$privileges = 0;
|
$privileges = 0;
|
||||||
|
|
||||||
if (filter_has_var(INPUT_POST, "privileges")) {
|
if ($_POST["administrator"] != $userInfo["privileges"]) {
|
||||||
$privileges = 1;
|
$privileges = 1;
|
||||||
|
} else {
|
||||||
|
$privileges = $userInfo["privileges"];
|
||||||
}
|
}
|
||||||
|
if ($_POST["moderator"] != $userInfo["privileges"]) {
|
||||||
|
$privileges = 2;
|
||||||
|
} else {
|
||||||
|
$privileges = $userInfo["privileges"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$insert = $conn->prepare("INSERT INTO " . $userTableName . " (username, password, discord, discordLink, twitch, youtube, youtubeLink, privileges) VALUES (:username, :password, :discord, :discordLink, :twitch, :youtube, :youtubeLink, :privileges)");
|
$insert = $conn->prepare("INSERT INTO " . $userTableName . " (username, password, discord, discordLink, twitch, youtube, youtubeLink, privileges) VALUES (:username, :password, :discord, :discordLink, :twitch, :youtube, :youtubeLink, :privileges)");
|
||||||
|
|
||||||
@ -80,7 +88,7 @@
|
|||||||
echo "<div class=userMessage>";
|
echo "<div class=userMessage>";
|
||||||
echo "<p>Account created! You may sign in now.</p>";
|
echo "<p>Account created! You may sign in now.</p>";
|
||||||
echo "<p> </p>";
|
echo "<p> </p>";
|
||||||
echo "<a href=\"/\" class=\"subNavLink\">HOME</a>";
|
echo "<a href=\"/\" class=\"subNavLink\" onclick=\"redirect('this', '/')\">HOME</a>";
|
||||||
echo "<a href=\"/user/login_page.php\" target=\"dataFrame\" class=\"subNavLink\">SIGN IN</a>";
|
echo "<a href=\"/user/login_page.php\" target=\"dataFrame\" class=\"subNavLink\">SIGN IN</a>";
|
||||||
echo "<p> </p>";
|
echo "<p> </p>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
@ -25,8 +25,14 @@
|
|||||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
|
||||||
// Grab session username to make sure we're updating the person logged in
|
// Grab username to make sure we're updating the person logged in
|
||||||
$username = $_SESSION["username"];
|
if (isset ($_POST["username"])) {
|
||||||
|
// If there was a username sent via POST i.e. we're editing a user
|
||||||
|
$username = $_POST["username"];
|
||||||
|
} else {
|
||||||
|
// otherwise use the person logged in
|
||||||
|
$username = $_SESSION["username"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Grab the existing data, so we can only update the things that got updated
|
// Grab the existing data, so we can only update the things that got updated
|
||||||
@ -79,9 +85,20 @@
|
|||||||
echo "<p></p>";
|
echo "<p></p>";
|
||||||
|
|
||||||
|
|
||||||
|
if ($_POST["administrator"] != $userInfo["privileges"]) {
|
||||||
|
$privileges = 1;
|
||||||
|
} else {
|
||||||
|
$privileges = $userInfo["privileges"];
|
||||||
|
}
|
||||||
|
if ($_POST["moderator"] != $userInfo["privileges"]) {
|
||||||
|
$privileges = 2;
|
||||||
|
} else {
|
||||||
|
$privileges = $userInfo["privileges"];
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare the command
|
// Prepare the command
|
||||||
$update = $conn->prepare("UPDATE " . $userTableName . " SET
|
$update = $conn->prepare("UPDATE " . $userTableName . " SET
|
||||||
|
privileges = :privileges,
|
||||||
twitch = :twitch,
|
twitch = :twitch,
|
||||||
youtube = :youtube,
|
youtube = :youtube,
|
||||||
youtubeLink = :youtubeLink,
|
youtubeLink = :youtubeLink,
|
||||||
@ -92,6 +109,7 @@
|
|||||||
|
|
||||||
// Bind parameters to query
|
// Bind parameters to query
|
||||||
$update->bindParam(":username", $username);
|
$update->bindParam(":username", $username);
|
||||||
|
$update->bindParam(":privileges", $privileges);
|
||||||
$update->bindParam(":twitch", $twitch);
|
$update->bindParam(":twitch", $twitch);
|
||||||
$update->bindParam(":youtube", $youtube);
|
$update->bindParam(":youtube", $youtube);
|
||||||
$update->bindParam(":youtubeLink", $youtubeLink);
|
$update->bindParam(":youtubeLink", $youtubeLink);
|
||||||
|
96
admin/user_management/user_edit_form.php
Normal file
96
admin/user_management/user_edit_form.php
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
include("../db_config.php"); // Include database
|
||||||
|
|
||||||
|
// This grabs the list of users to check and make sure we aren't creating duplicates
|
||||||
|
|
||||||
|
try { // Try opening the SQL database connection
|
||||||
|
$conn = new PDO("mysql:host=$servername; dbname=$dbName", $dbUsername, $dbPassword);
|
||||||
|
// set the PDO error mode to exception
|
||||||
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
$username = $_GET["username"];
|
||||||
|
|
||||||
|
// Grab the list of users from the user list
|
||||||
|
$sqlGetUserData = $conn->prepare("SELECT * FROM " . $userTableName . " WHERE username=\"" . $username . "\"");
|
||||||
|
|
||||||
|
|
||||||
|
// Execute SQL query
|
||||||
|
$sqlGetUserData->execute();
|
||||||
|
|
||||||
|
// Get results
|
||||||
|
$userData = $sqlGetUserData->fetch();
|
||||||
|
|
||||||
|
|
||||||
|
} 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" />
|
||||||
|
<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="/styles/user_management.css" />
|
||||||
|
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
|
||||||
|
<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>
|
||||||
|
<script src="/scripts/user_management.js"></script>
|
||||||
|
<script src="/scripts/tools.js"></script>
|
||||||
|
<script>verifyPageInFrame()</script>
|
||||||
|
<title>USER EDITING FORM</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body id="userEditBody">
|
||||||
|
<div id="userEditPanel">
|
||||||
|
<p> </p>
|
||||||
|
<hr >
|
||||||
|
<form id="userForm" action="edit_user.php" onsubmit="return verifyInput()" method="POST" target="dataFrame">
|
||||||
|
<!-- THIS DIV IS FOR INPUT -->
|
||||||
|
<div id="textInputArea">
|
||||||
|
<label for="discord" class="newLine">Discord:</label>
|
||||||
|
<input type="text" placeholder="<?php echo $userData["discord"] ?>" id="discord" name="discord" class="newLine" style="width:100%" maxlength="50"/>
|
||||||
|
<label for="discord" class="newLine">Discord Link:</label>
|
||||||
|
<input type="text" placeholder="<?php echo $userData["discordLink"] ?>" id="discordLink" name="discordLink" class="newLine" style="width:100%" maxlength="50"/>
|
||||||
|
<label for="twitch" class="newLine">Twitch:</label>
|
||||||
|
<input type="text" placeholder="<?php echo $userData["twitch"] ?>" id="twitch" name="twitch" class="newLine" style="width:100%" maxlength="50" />
|
||||||
|
<label for="youtube" class="newLine">Youtube:</label>
|
||||||
|
<input type="text" placeholder="<?php echo $userData["youtube"] ?>" id="youtube" name="youtube" class="newLine" style="width:100%" maxlength="50" />
|
||||||
|
<label for="youtube" class="newLine">Youtube Link:</label>
|
||||||
|
<input type="text" placeholder="<?php echo $userData["youtubeLink"] ?>" id="youtubeLink" name="youtubeLink" class="newLine" style="width:100%" maxlength="50" />
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<!-- THIS DIV IS FOR EXTRA SETTINGS -->
|
||||||
|
<div id="extraOptions">
|
||||||
|
<h4>EXTRA OPTIONS</h4>
|
||||||
|
<h5 class="newLine underlined bolded larger">User Type</h5>
|
||||||
|
<p class="newLine"></p>
|
||||||
|
<input type="radio" id="regular" name="privileges" value="regular" class="extraOptions">
|
||||||
|
<label for="regular" class="extraOptions">Regular</label>
|
||||||
|
<input type="radio" id="moderator" name="privileges" value="moderator" class="extraOptions">
|
||||||
|
<label for="moderator" class="extraOptions">Moderator</label>
|
||||||
|
<input type="radio" id="administrator" name="privileges" value="administrator" class="extraOptions">
|
||||||
|
<label for="administrator" class="extraOptions">Administrator</label>
|
||||||
|
<p class="newLine"> </p>
|
||||||
|
<p class="newLine"><span class="bolded">Moderators:</span> More details coming soon</p>
|
||||||
|
<p class="newLine"><span class="bolded">Administrators:</span> Have FULL access to the admin panel</p>
|
||||||
|
</div>
|
||||||
|
<p> </p>
|
||||||
|
<input type="submit" value="EDIT" />
|
||||||
|
</form>
|
||||||
|
<script>setPrivilegeLevel(<?php echo $userData["privileges"]; ?>)</script>
|
||||||
|
|
||||||
|
<div id="userEditFrameDiv">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p> </p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
88
admin/user_management/user_edit_frame.php
Normal file
88
admin/user_management/user_edit_frame.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
include("../db_config.php"); // Include database
|
||||||
|
|
||||||
|
// This grabs the list of users to check and make sure we aren't creating duplicates
|
||||||
|
|
||||||
|
try { // Try opening the SQL database connection
|
||||||
|
$conn = new PDO("mysql:host=$servername; dbname=$dbName", $dbUsername, $dbPassword);
|
||||||
|
// set the PDO error mode to exception
|
||||||
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
// Grab the list of users from the user list
|
||||||
|
$sqlGetUserData = $conn->prepare("SELECT username FROM " . $userTableName . "");
|
||||||
|
|
||||||
|
|
||||||
|
// Execute SQL query
|
||||||
|
$sqlGetUserData->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"];
|
||||||
|
}
|
||||||
|
} 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" />
|
||||||
|
<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="/styles/user_management.css" />
|
||||||
|
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
|
||||||
|
<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>
|
||||||
|
<script src="/scripts/user_management.js"></script>
|
||||||
|
<script src="/scripts/tools.js"></script>
|
||||||
|
<script>verifyPageInFrame()</script>
|
||||||
|
<script>
|
||||||
|
var userList = <?php echo json_encode($userList); ?>; // Convert array from PHP to JS
|
||||||
|
$( function() {
|
||||||
|
$("#user").autocomplete({
|
||||||
|
source: userList,
|
||||||
|
// This only allows listed items to be chosen
|
||||||
|
change: function (event, ui) {
|
||||||
|
if(!ui.item) {
|
||||||
|
$("#user").val("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
<title>USER CREATION FORM</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body id="generalBody">
|
||||||
|
<div id="userEditPanel">
|
||||||
|
<h2>USER EDITING</h2>
|
||||||
|
<p>Edit users here</p>
|
||||||
|
<hr>
|
||||||
|
<p></p>
|
||||||
|
|
||||||
|
<div id="textInputArea" class="userForm">
|
||||||
|
<label for="user">User:</label>
|
||||||
|
<input type="text" id="user" name="user" maxlength="30" tabindex="1" >
|
||||||
|
<button value="SEARCH" class="normalButton" onclick="editUser()">SEARCH</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="userEditFrameDiv">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p> </p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,3 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
include("../db_config.php"); // Include database
|
||||||
|
|
||||||
|
// This grabs the list of users to check and make sure we aren't creating duplicates
|
||||||
|
|
||||||
|
try { // Try opening the SQL database connection
|
||||||
|
$conn = new PDO("mysql:host=$servername; dbname=$dbName", $dbUsername, $dbPassword);
|
||||||
|
// set the PDO error mode to exception
|
||||||
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
// Grab the list of users from the user list
|
||||||
|
$sqlGetUserData = $conn->prepare("SELECT username FROM " . $userTableName . "");
|
||||||
|
|
||||||
|
|
||||||
|
// Execute SQL query
|
||||||
|
$sqlGetUserData->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"];
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) { // failed connection
|
||||||
|
echo "Connection failed: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
@ -11,6 +45,7 @@
|
|||||||
<script src="/scripts/user_management.js"></script>
|
<script src="/scripts/user_management.js"></script>
|
||||||
<script src="/scripts/tools.js"></script>
|
<script src="/scripts/tools.js"></script>
|
||||||
<script>verifyPageInFrame()</script>
|
<script>verifyPageInFrame()</script>
|
||||||
|
<script>var userList = <?php echo json_encode($userList); ?>; // Convert array from PHP to JS</script>
|
||||||
<title>USER CREATION FORM</title>
|
<title>USER CREATION FORM</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -24,9 +59,10 @@
|
|||||||
<!-- THIS DIV IS FOR INPUT -->
|
<!-- THIS DIV IS FOR INPUT -->
|
||||||
<div id="textInputArea">
|
<div id="textInputArea">
|
||||||
<label for="username" class="inputLabel" >Username:</label>
|
<label for="username" class="inputLabel" >Username:</label>
|
||||||
<input type="text" id="username" name="username" maxlength="30" required/>
|
<input type="text" id="username" name="username" class="newLine" maxlength="30" oninput="usernameConfirm()" tabindex="1" pattern="[a-zA-Z0-9]*" required>
|
||||||
|
<p id="confirmUsername"></p>
|
||||||
<label for="password" class="inputLabel newLine">Password:</label>
|
<label for="password" class="inputLabel newLine">Password:</label>
|
||||||
<input type="password" id="password" name="password" minlength="6" required/>
|
<input type="password" id="password" name="password" minlength="6" oninput="checkPasswordRequirements()" required/>
|
||||||
<input type="checkbox" id="showPassword" name="showPassword" class="passwordOptions" onclick="displayPassword()"/>
|
<input type="checkbox" id="showPassword" name="showPassword" class="passwordOptions" onclick="displayPassword()"/>
|
||||||
<label for="showPassword" class="passwordOptions" id="displayPassword" class="newLine">(show)</label>
|
<label for="showPassword" class="passwordOptions" id="displayPassword" class="newLine">(show)</label>
|
||||||
<label for="discord" class="newLine">Discord:</label>
|
<label for="discord" class="newLine">Discord:</label>
|
||||||
@ -45,10 +81,17 @@
|
|||||||
<div id="extraOptions">
|
<div id="extraOptions">
|
||||||
<h4>EXTRA OPTIONS</h4>
|
<h4>EXTRA OPTIONS</h4>
|
||||||
<p class="newLine"> </p>
|
<p class="newLine"> </p>
|
||||||
<input type="checkbox" id="privileges" name="privileges" class="extraOptions">
|
<h5 class="newLine underlined bolded larger">User Type</h5>
|
||||||
<label for="privileges" 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>
|
<p class="newLine"></p>
|
||||||
|
<input type="radio" id="regular" name="privileges" value="regular" class="extraOptions" checked>
|
||||||
|
<label for="regular" class="extraOptions">Regular</label>
|
||||||
|
<input type="radio" id="moderator" name="privileges" value="moderator" class="extraOptions">
|
||||||
|
<label for="moderator" class="extraOptions">Moderator</label>
|
||||||
|
<input type="radio" id="administrator" name="privileges" value="administrator" class="extraOptions">
|
||||||
|
<label for="administrator" class="extraOptions">Administrator</label>
|
||||||
|
<p class="newLine"> </p>
|
||||||
|
<p class="newLine"><span class="bolded">Moderators:</span> More details coming soon</p>
|
||||||
|
<p class="newLine"><span class="bolded">Administrators:</span> Have FULL access to the admin panel</p>
|
||||||
</div>
|
</div>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
<input type="submit" value="CREATE" />
|
<input type="submit" value="CREATE" />
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
function randomPassword() {
|
function randomPassword() {
|
||||||
// Grab the length of password the user wants
|
|
||||||
var passwordLength = document.getElementById("passwordLength").value;
|
|
||||||
var password = "";
|
var password = "";
|
||||||
|
var passwordLength = 8;
|
||||||
|
|
||||||
// The character set of the password. Modify this at your discretion
|
// The character set of the password. Modify this at your discretion
|
||||||
var charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
var charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||||
@ -12,7 +11,10 @@ function randomPassword() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the password field to what we've generated
|
// Set the password field to what we've generated
|
||||||
document.getElementById("password").value = password;
|
//document.getElementById("password").value = password;
|
||||||
|
//document.getElementById("confirmPassword").value = password;
|
||||||
|
console.log(password);
|
||||||
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyInput() {
|
function verifyInput() {
|
||||||
@ -65,13 +67,13 @@ function passwordConfirm() {
|
|||||||
if (confirmPassword == "") {
|
if (confirmPassword == "") {
|
||||||
document.getElementById("matchingPasswords").style.visibility = "hidden";
|
document.getElementById("matchingPasswords").style.visibility = "hidden";
|
||||||
document.getElementById("matchingPasswordsText").style.visibility = "hidden";
|
document.getElementById("matchingPasswordsText").style.visibility = "hidden";
|
||||||
document.getElementById("confirmPassword").style.border = null;
|
document.getElementById("confirmPassword").style.outline = null;
|
||||||
return false;
|
return false;
|
||||||
} else if (password == confirmPassword) { // If they match, show them green and return true
|
} else if (password == confirmPassword) { // If they match, show them green and return true
|
||||||
document.getElementById("matchingPasswords").style.visibility = "visible";
|
document.getElementById("matchingPasswords").style.visibility = "visible";
|
||||||
document.getElementById("matchingPasswords").style.color = "green" ;
|
document.getElementById("matchingPasswords").style.color = "green" ;
|
||||||
document.getElementById("matchingPasswords").innerHTML = "✓ ";
|
document.getElementById("matchingPasswords").innerHTML = "✓ ";
|
||||||
document.getElementById("confirmPassword").style.border = "1px solid green";
|
document.getElementById("confirmPassword").style.outline = "1px solid green";
|
||||||
document.getElementById("matchingPasswordsText").style.visibility = "visible";
|
document.getElementById("matchingPasswordsText").style.visibility = "visible";
|
||||||
document.getElementById("matchingPasswordsText").innerHTML = "Match!";
|
document.getElementById("matchingPasswordsText").innerHTML = "Match!";
|
||||||
return true;
|
return true;
|
||||||
@ -79,7 +81,7 @@ function passwordConfirm() {
|
|||||||
document.getElementById("matchingPasswords").style.visibility = "visible";
|
document.getElementById("matchingPasswords").style.visibility = "visible";
|
||||||
document.getElementById("matchingPasswords").style.color = "red";
|
document.getElementById("matchingPasswords").style.color = "red";
|
||||||
document.getElementById("matchingPasswords").innerHTML = "Χ ";
|
document.getElementById("matchingPasswords").innerHTML = "Χ ";
|
||||||
document.getElementById("confirmPassword").style.border = "2px solid red";
|
document.getElementById("confirmPassword").style.outline = "2px solid red";
|
||||||
document.getElementById("matchingPasswordsText").style.visibility = "visible";
|
document.getElementById("matchingPasswordsText").style.visibility = "visible";
|
||||||
document.getElementById("matchingPasswordsText").innerHTML = "Not a match!";
|
document.getElementById("matchingPasswordsText").innerHTML = "Not a match!";
|
||||||
return false;
|
return false;
|
||||||
@ -94,13 +96,13 @@ function passwordConfirmLite() {
|
|||||||
|
|
||||||
// If the field is empty we'll hide the results
|
// If the field is empty we'll hide the results
|
||||||
if (confirmPassword == "") {
|
if (confirmPassword == "") {
|
||||||
document.getElementById("confirmPassword").style.border = null;
|
document.getElementById("confirmPassword").style.outline = null;
|
||||||
return false;
|
return false;
|
||||||
} else if (password == confirmPassword) { // If they match
|
} else if (password == confirmPassword) { // If they match
|
||||||
document.getElementById("confirmPassword").style.border = "1px solid green";
|
document.getElementById("confirmPassword").style.outline = "1px solid green";
|
||||||
return true;
|
return true;
|
||||||
} else if (password != confirmPassword) {
|
} else if (password != confirmPassword) {
|
||||||
document.getElementById("confirmPassword").style.border = "2px solid red";
|
document.getElementById("confirmPassword").style.outline = "2px solid red";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,19 +118,19 @@ function usernameConfirm() {
|
|||||||
// If the name is there, return false
|
// If the name is there, return false
|
||||||
if (username == "") {
|
if (username == "") {
|
||||||
document.getElementById("confirmUsername").style.visibility = "hidden";
|
document.getElementById("confirmUsername").style.visibility = "hidden";
|
||||||
document.getElementById("username").style.border = null;
|
document.getElementById("username").style.outline = null;
|
||||||
return false;
|
return false;
|
||||||
} else if (listOfUsers.includes(username)) {
|
} else if (listOfUsers.includes(username)) {
|
||||||
document.getElementById("confirmUsername").style.visibility = "visible";
|
document.getElementById("confirmUsername").style.visibility = "visible";
|
||||||
document.getElementById("confirmUsername").style.color = "red";
|
document.getElementById("confirmUsername").style.color = "red";
|
||||||
document.getElementById("confirmUsername").innerHTML = "Taken";
|
document.getElementById("confirmUsername").innerHTML = "Taken";
|
||||||
document.getElementById("username").style.border = "2px solid red";
|
document.getElementById("username").style.outline = "2px solid red";
|
||||||
return false; // we return false for a match - a match is not what we want!
|
return false; // we return false for a match - a match is not what we want!
|
||||||
} else if (!listOfUsers.includes(username)) {
|
} else if (!listOfUsers.includes(username)) {
|
||||||
document.getElementById("confirmUsername").style.visibility = "visible";
|
document.getElementById("confirmUsername").style.visibility = "visible";
|
||||||
document.getElementById("confirmUsername").style.color = "green";
|
document.getElementById("confirmUsername").style.color = "green";
|
||||||
document.getElementById("confirmUsername").innerHTML = "";
|
document.getElementById("confirmUsername").innerHTML = "";
|
||||||
document.getElementById("username").style.border = "1px solid green";
|
document.getElementById("username").style.outline = "1px solid green";
|
||||||
return true; // this means the user does not already exist and is good to go
|
return true; // this means the user does not already exist and is good to go
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,15 +140,16 @@ function checkPasswordRequirements() {
|
|||||||
console.log(password);
|
console.log(password);
|
||||||
|
|
||||||
if (password == "") {
|
if (password == "") {
|
||||||
document.getElementById("password").style.border = null;
|
document.getElementById("password").style.outline = null;
|
||||||
} else if (password.length < 6) {
|
} else if (password.length < 6) {
|
||||||
document.getElementById("password").style.border = "2px solid red";
|
document.getElementById("password").style.outline = "2px solid red";
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("password").style.border = "1px solid green";
|
document.getElementById("password").style.outline = "1px solid green";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function togglePWChange() {
|
function togglePWChange() {
|
||||||
|
// This function handles the switch between showing the socials edit panel and the password change panel
|
||||||
var socialsDiv = document.getElementById("accountSocialsPanel");
|
var socialsDiv = document.getElementById("accountSocialsPanel");
|
||||||
|
|
||||||
var pwChangeDiv = document.getElementById("passwordChangePanel");
|
var pwChangeDiv = document.getElementById("passwordChangePanel");
|
||||||
@ -167,6 +170,32 @@ function togglePWChange() {
|
|||||||
pwChangeDiv.style.display = "flex";
|
pwChangeDiv.style.display = "flex";
|
||||||
pwChangeDiv.style.zIndex = "1";
|
pwChangeDiv.style.zIndex = "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function editUser() {
|
||||||
|
console.log("YAASSS");
|
||||||
|
var div = document.getElementById("userEditFrameDiv");
|
||||||
|
username = document.getElementById("user").value;
|
||||||
|
var html = "";
|
||||||
|
|
||||||
|
|
||||||
|
html += "<iframe src=\"/admin/user_management/user_edit_form.php?username=" + username + "\" name=\"dataFrame\" class=\"dataFrame\" id=\"dataFrame\" onload=\"resizeIframe(this);var obj=parent.document.getElementById('dataFrame');resizeIframe(obj);\"></iframe>";
|
||||||
|
|
||||||
|
div.innerHTML = html;
|
||||||
|
|
||||||
|
console.log(html);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setPrivilegeLevel(privileges) {
|
||||||
|
switch (privileges){
|
||||||
|
case 0:
|
||||||
|
document.getElementById("regular").checked = true;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
document.getElementById("administrator").checked = true;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
document.getElementById("moderator").checked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
width: 800px;
|
width: 800px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#informationContentPanel {
|
#informationContentPanel {
|
||||||
|
@ -23,6 +23,17 @@
|
|||||||
line-height: 0.25em;
|
line-height: 0.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.underlined {
|
||||||
|
text-decoration-line: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bolded {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.larger {
|
||||||
|
font-size: 1.25em;
|
||||||
|
}
|
||||||
|
|
||||||
.backgroundImage {
|
.backgroundImage {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
#userFormPanel {
|
#userFormPanel {
|
||||||
width: 500px;
|
width: 500px;
|
||||||
|
margin: auto;
|
||||||
|
text-align: center;
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
}
|
}
|
||||||
|
#userEditPanel {
|
||||||
#userFormPanel {
|
width: 500px;
|
||||||
|
min-height: 400px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#userEditBody {
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
#createAccountPanel {
|
#createAccountPanel {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
@ -20,6 +27,7 @@
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
#accountSocialsPanel {
|
#accountSocialsPanel {
|
||||||
@ -29,7 +37,6 @@
|
|||||||
width: 45%;
|
width: 45%;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
||||||
margin-right: 2%;
|
margin-right: 2%;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
padding-bottom: 25px;
|
padding-bottom: 25px;
|
||||||
@ -181,6 +188,7 @@
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
width:70%
|
||||||
}
|
}
|
||||||
|
|
||||||
#userForm input {
|
#userForm input {
|
||||||
@ -191,6 +199,7 @@
|
|||||||
#userForm label {
|
#userForm label {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
align-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#userForm input[type="submit"] {
|
#userForm input[type="submit"] {
|
||||||
@ -228,6 +237,78 @@
|
|||||||
padding: 7px 10px;
|
padding: 7px 10px;
|
||||||
margin: 1% 6%;
|
margin: 1% 6%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.userForm input {
|
||||||
|
background-color: rgba(255, 255, 255, 0.6);
|
||||||
|
border: 1px solid rgb(0, 0, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
.userForm label {
|
||||||
|
text-align: left;
|
||||||
|
font-weight: bold;
|
||||||
|
align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userForm button {
|
||||||
|
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 rgb(0, 0, 255);
|
||||||
|
box-shadow: 0px 2px 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userForm button:hover {
|
||||||
|
color: black;
|
||||||
|
background-color: rgba(255, 165, 0, .6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.userForm button:active {
|
||||||
|
box-shadow: 0px 0px 2px;
|
||||||
|
transform: translateY(2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.userForm input[type="button"] {
|
||||||
|
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 rgb(0, 0, 255);
|
||||||
|
box-shadow: 0px 2px 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userForm input[type="button"]:hover {
|
||||||
|
color: black;
|
||||||
|
background-color: rgba(255, 165, 0, .6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.userForm input[type="button"]:active {
|
||||||
|
box-shadow: 0px 0px 2px;
|
||||||
|
transform: translateY(2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.userForm input[type="text"] {
|
||||||
|
border-radius: 5px;
|
||||||
|
width: 150px;
|
||||||
|
padding: 7px 10px;
|
||||||
|
margin: 1% 6%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userForm input[type="password"] {
|
||||||
|
border-radius: 5px;
|
||||||
|
width: 150px;
|
||||||
|
padding: 7px 10px;
|
||||||
|
margin: 1% 6%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.inputLabel {
|
.inputLabel {
|
||||||
width:100%;
|
width:100%;
|
||||||
}
|
}
|
||||||
@ -237,13 +318,14 @@
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
#extraOptions h4 {
|
#extraOptions h4 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
#extraOptions p {
|
#extraOptions p {
|
||||||
text-align: left;
|
text-align: center;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +359,7 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
font-weight: normal;
|
font-weight: normal !important;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,3 +396,9 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.normalButton {
|
||||||
|
padding: 4px 15px !important;
|
||||||
|
font-size: 100% !important;
|
||||||
|
font-weight: normal !important;
|
||||||
|
}
|
@ -91,8 +91,8 @@ try { // Try opening the SQL database connection
|
|||||||
<p> </p>
|
<p> </p>
|
||||||
<div id="accountDetailsBody">
|
<div id="accountDetailsBody">
|
||||||
<div id="accountDetailsPanel">
|
<div id="accountDetailsPanel">
|
||||||
<h3>Info</h3>
|
<h3 class="newLine">Info</h3>
|
||||||
<p class="newLine"></p>
|
<p></p>
|
||||||
<div class="accountDetailsLeftSide">
|
<div class="accountDetailsLeftSide">
|
||||||
<p class="detailsBold">Username:</p>
|
<p class="detailsBold">Username:</p>
|
||||||
<p class="detailsBold">Date Joined:</p>
|
<p class="detailsBold">Date Joined:</p>
|
||||||
@ -119,8 +119,8 @@ try { // Try opening the SQL database connection
|
|||||||
if (mb_strtolower($username) == mb_strtolower($_SESSION["username"])) {
|
if (mb_strtolower($username) == mb_strtolower($_SESSION["username"])) {
|
||||||
echo ("
|
echo ("
|
||||||
<div id=\"accountSocialsPanel\">
|
<div id=\"accountSocialsPanel\">
|
||||||
<h3>Edit</h3>
|
<h3 class=\"newLine\">Edit</h3>
|
||||||
<p class=\"newLine\"></p>
|
<p></p>
|
||||||
<div class=\"accountDetailsLeftSide\">
|
<div class=\"accountDetailsLeftSide\">
|
||||||
<p>Twitch (name):</p>
|
<p>Twitch (name):</p>
|
||||||
<p>YouTube (name):</p>
|
<p>YouTube (name):</p>
|
||||||
@ -149,8 +149,8 @@ try { // Try opening the SQL database connection
|
|||||||
"/* PASSWORD CHANGE */ . "
|
"/* PASSWORD CHANGE */ . "
|
||||||
"/* */ . "
|
"/* */ . "
|
||||||
<div id=\"passwordChangePanel\">
|
<div id=\"passwordChangePanel\">
|
||||||
<h3>Change Password</h3>
|
<h3 class=\"newLine\">Change Password</h3>
|
||||||
<p class=\"newLine\"></p>
|
<p></p>
|
||||||
<div class=\"accountDetailsLeftSide\">
|
<div class=\"accountDetailsLeftSide\">
|
||||||
<p>Old Password:</p>
|
<p>Old Password:</p>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user