modified users table, class and sign in class
This commit is contained in:
@@ -35,8 +35,7 @@
|
||||
define("INITIALIZATION_FILE_NAME", "../xml/settings.xml");
|
||||
define("INIT_SCRIPT_USER", "Init Script");
|
||||
|
||||
// Safety switch.
|
||||
// Change this to true when you intentionally want to rebuild system tables.
|
||||
// Safety switch - Change this to true when you intentionally want to rebuild system tables.
|
||||
$allow_rebuild = true;
|
||||
|
||||
if (!$allow_rebuild) {
|
||||
@@ -44,9 +43,9 @@
|
||||
exit();
|
||||
}
|
||||
|
||||
// --------------------------
|
||||
// Load Application Settings
|
||||
// --------------------------
|
||||
// --------------------------
|
||||
// Load Application Settings
|
||||
// --------------------------
|
||||
|
||||
$applicationSettings = simplexml_load_file(INITIALIZATION_FILE_NAME);
|
||||
|
||||
@@ -55,9 +54,9 @@
|
||||
exit();
|
||||
}
|
||||
|
||||
// ---------------------
|
||||
// Database Connection
|
||||
// ---------------------
|
||||
// ---------------------
|
||||
// Database Connection
|
||||
// ---------------------
|
||||
|
||||
$host = (string) $applicationSettings->DatabaseServer;
|
||||
$database = (string) $applicationSettings->DatabaseName;
|
||||
@@ -66,8 +65,7 @@
|
||||
|
||||
try {
|
||||
$connection = new PDO(
|
||||
"mysql:host={$host};dbname={$database};charset=utf8mb4",
|
||||
$user,
|
||||
"mysql:host={$host};dbname={$database};charset=utf8mb4", $user,
|
||||
$password,
|
||||
[
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
@@ -82,17 +80,13 @@
|
||||
exit();
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Get Table Definition Files
|
||||
// ----------------------------
|
||||
// ----------------------------
|
||||
// Get Table Definition Files
|
||||
// ----------------------------
|
||||
|
||||
$tableFiles = glob("*.php");
|
||||
|
||||
$excludedFiles = [
|
||||
"_createSystemTable.php",
|
||||
"_createTable.php",
|
||||
basename(__FILE__),
|
||||
];
|
||||
$excludedFiles = ["_createSystemTable.php", "_createTable.php", basename(__FILE__),];
|
||||
|
||||
$tableFiles = array_values(array_filter($tableFiles, function ($file) use ($excludedFiles) {
|
||||
return !in_array($file, $excludedFiles, true);
|
||||
@@ -100,9 +94,9 @@
|
||||
|
||||
sort($tableFiles);
|
||||
|
||||
// ----------------------------
|
||||
// Process Table Files
|
||||
// ----------------------------
|
||||
// -------------------
|
||||
// Process Table Files
|
||||
// -------------------
|
||||
|
||||
foreach ($tableFiles as $tableFile) {
|
||||
|
||||
@@ -160,9 +154,9 @@
|
||||
|
||||
echoLog("System tables created successfully.", "success");
|
||||
|
||||
// -------------------------
|
||||
// Helper Functions
|
||||
// -------------------------
|
||||
// ----------------
|
||||
// Helper Functions
|
||||
// ----------------
|
||||
|
||||
function runSQL($SQL, PDO $connection, $context = "query") {
|
||||
try {
|
||||
@@ -221,23 +215,20 @@
|
||||
],
|
||||
];
|
||||
|
||||
$SQL = "
|
||||
INSERT INTO popovers (
|
||||
popover_name,
|
||||
popover_title,
|
||||
popover_placeholder,
|
||||
popover_text,
|
||||
popover_created,
|
||||
popover_creator
|
||||
) VALUES (
|
||||
:popover_name,
|
||||
:popover_title,
|
||||
:popover_placeholder,
|
||||
:popover_text,
|
||||
CURDATE(),
|
||||
:popover_creator
|
||||
)
|
||||
";
|
||||
$SQL = " INSERT INTO popovers (
|
||||
popover_name,
|
||||
popover_title,
|
||||
popover_placeholder,
|
||||
popover_text,
|
||||
popover_created,
|
||||
popover_creator
|
||||
) VALUES (
|
||||
:popover_name,
|
||||
:popover_title,
|
||||
:popover_placeholder,
|
||||
:popover_text,
|
||||
CURDATE(),
|
||||
:popover_creator )";
|
||||
|
||||
$statement = $connection->prepare($SQL);
|
||||
|
||||
@@ -258,40 +249,33 @@
|
||||
|
||||
$password = password_hash("349Jamot@", PASSWORD_DEFAULT);
|
||||
|
||||
$SQL = "
|
||||
INSERT INTO users (
|
||||
user_id,
|
||||
user_name,
|
||||
user_email,
|
||||
user_password,
|
||||
user_role,
|
||||
user_change_password,
|
||||
user_active,
|
||||
user_creator,
|
||||
user_created
|
||||
) VALUES (
|
||||
:user_id,
|
||||
:user_name,
|
||||
:user_email,
|
||||
:user_password,
|
||||
:user_role,
|
||||
:user_change_password,
|
||||
:user_active,
|
||||
:user_creator,
|
||||
CURDATE()
|
||||
)
|
||||
";
|
||||
$SQL = "INSERT INTO users (
|
||||
user_name,
|
||||
user_first_name,
|
||||
user_last_name,
|
||||
user_email,
|
||||
user_password_hash,
|
||||
user_role,
|
||||
user_creator
|
||||
|
||||
) VALUES (
|
||||
:user_name,
|
||||
:user_first_name,
|
||||
:user_last_name,
|
||||
:user_email,
|
||||
:user_password_hash,
|
||||
:user_role,
|
||||
:user_creator )";
|
||||
|
||||
$statement = $connection->prepare($SQL);
|
||||
|
||||
$statement->execute([
|
||||
":user_id" => "DSYSADMIN",
|
||||
":user_name" => "James Richie",
|
||||
":user_name" => "jric11",
|
||||
":user_first_name" => "James",
|
||||
":user_last_name" => "Richie",
|
||||
":user_email" => "james.richie@onesourceits.com",
|
||||
":user_password" => $password,
|
||||
":user_password_hash" => $password,
|
||||
":user_role" => "Administrator",
|
||||
":user_change_password" => 1,
|
||||
":user_active" => 1,
|
||||
":user_creator" => INIT_SCRIPT_USER,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user