From 8308b4729580749e44f21d8af2ddf8bcda90a94b Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 11 Mar 2023 18:35:15 -0500 Subject: [PATCH] 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 --- setup.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/setup.php b/setup.php index eb607057..9f6e3b33 100644 --- a/setup.php +++ b/setup.php @@ -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 {