2025-03-03 21:14:00 -05:00
|
|
|
<?php
|
|
|
|
include("admin/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
|
2025-03-05 21:08:39 -05:00
|
|
|
$conn = new PDO("mysql:host=$servername; dbname=$dbName", $dbUsername, $dbPassword);
|
2025-03-03 21:14:00 -05:00
|
|
|
// 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" />
|
2025-03-05 21:08:39 -05:00
|
|
|
<link rel="stylesheet" href="/styles/admin.css" />
|
|
|
|
<link rel="stylesheet" href="/styles/admin_nav.css" />
|
|
|
|
<link rel="stylesheet" href="/styles/user_management.css" />
|
2025-03-08 16:38:13 -05:00
|
|
|
<script src="/scripts/tools.js"></script>
|
|
|
|
<script>verifyPageInFrame()</script>
|
2025-03-03 21:14:00 -05:00
|
|
|
<?php include ("admin/db_config.php");?> <!-- Our password-length variable is stored here -->
|
2025-03-05 21:08:39 -05:00
|
|
|
<script src="/scripts/user_management.js"></script>
|
2025-03-03 21:14:00 -05:00
|
|
|
<title>USER CREATION FORM</title>
|
|
|
|
<script>var userList = <?php echo json_encode($userList); ?>; // Convert array from PHP to JS</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body id="generalBody">
|
|
|
|
<div id="createAccountPanel">
|
|
|
|
<h2>Create An Account!</h2>
|
|
|
|
<p>Get started on your trophy-winning journey with your very own TrojanDestinyRL account!</p>
|
|
|
|
<hr>
|
|
|
|
<p></p>
|
2025-03-05 21:08:39 -05:00
|
|
|
<form id="userForm" action="/admin/user_management/add_user.php" onsubmit="return verifyInput()" method="POST" target="dataFrame" >
|
2025-03-03 21:14:00 -05:00
|
|
|
<!-- THIS DIV IS FOR INPUT -->
|
|
|
|
<div id="textInputArea">
|
|
|
|
<label for="username" class="inputLabel">Username:</label>
|
2025-03-03 22:15:48 -05:00
|
|
|
<input type="text" id="username" name="username" class="newLine" maxlength="30" onchange="usernameConfirm()" tabindex="1" pattern="[a-zA-Z0-9]*" required>
|
2025-03-03 21:14:00 -05:00
|
|
|
<p id="confirmUsername"></p>
|
|
|
|
<label for="password" class="inputLabel">Password:</label>
|
|
|
|
<input type="password" id="password" name="password" required tabindex="1">
|
|
|
|
<input type="checkbox" id="showPassword" name="showPassword" class="passwordOptions" onclick="displayPassword()" tabindex="-1">
|
|
|
|
<label for="showPassword" class="passwordOptions" id="displayPassword" class="newLine">(show)</label>
|
|
|
|
<label for="confirmPassword" class="inputLabel">Confirm password:</label>
|
|
|
|
<input type="password" id="confirmPassword" name="confirmPassword" oninput="passwordConfirm()" required tabindex="1">
|
|
|
|
<p id="matchingPasswords"></p>
|
|
|
|
<p id="matchingPasswordsText"></p>
|
|
|
|
</div>
|
|
|
|
<p> </p>
|
2025-03-03 22:15:48 -05:00
|
|
|
<input type="submit" value="CREATE" tabindex="1">
|
2025-03-03 21:14:00 -05:00
|
|
|
</form>
|
|
|
|
<p> </p>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|