Fix missing user_id var in Setup, removed sleep(2) as it did not fix the issues where config.php was not written instead used an if condition to check to see if config.php is written before going further

This commit is contained in:
johnnyq 2023-03-11 18:35:15 -05:00
parent e2f2960830
commit 8308b47295
1 changed files with 9 additions and 12 deletions

View File

@ -806,7 +806,11 @@ if (isset($_POST['add_database'])) {
file_put_contents("config.php", $new_config);
sleep(2);
if (!file_exists('config.php')) {
$_SESSION['alert_message'] = "Did not successfully write the config.php file to the filesystem, Please Input the database information again.";
header("Location: setup.php?database");
exit;
}
include("config.php");
@ -833,16 +837,9 @@ if (isset($_POST['add_database'])) {
}
}
if (file_exists('config.php')) {
$_SESSION['alert_message'] = "Database successfully added, now lets add a user.";
header("Location: setup.php?user");
exit;
} else {
$_SESSION['alert_message'] = "Did not successfully write the config.php file to the filesystem, Please Input the database information again.";
header("Location: setup.php?database");
exit;
}
$_SESSION['alert_message'] = "Database successfully added, now lets add a user.";
header("Location: setup.php?user");
exit;
}
@ -902,7 +899,7 @@ if (isset($_POST['add_user'])) {
move_uploaded_file($file_tmp_path, $dest_path);
//Set Avatar
mysqli_query($mysqli,"UPDATE users SET user_avatar = '$new_file_name' WHERE user_id = $user_id");
mysqli_query($mysqli,"UPDATE users SET user_avatar = '$new_file_name' WHERE user_id = 1");
$_SESSION['alert_message'] = 'File successfully uploaded.';
} else {