$errors[] = "Phone Number is required"; } else { $User_Phone = $_POST['User_Phone']; } if (!isset($_POST['User_Type'])) { $errors[] = "User type is required"; } else { $User_Type = $_POST['User_Type']; } if (!isset($_POST['User_ID'])) { $errors[] = "Please go back and refresh the site!"; } else { $User_ID = $_POST['User_ID']; } if ($admin_controller->Check_User_Name_For_Edit($User_Name, $User_ID)) { admin_redirect_error(Error_Type::SAME_USER_NAME); } if (empty($errors)) { $new_user = new User($User_Name, $User_Password, $User_Type, $User_Phone, $User_ID); $edited = $admin_controller->Edit_User($new_user); if ($edited) { admin_redirect_success(); } else { admin_redirect_error(Error_Type::DATA_BASE, $User_ID); } } else { admin_redirect_error(Error_Type::FORM, $User_ID); } } } }
} $dir = "VIEW/html/Admin/Employee_List.php?error={$error_type}"; $url = BASE_URL . $dir; header("Location:{$url}"); //redirect the admin to the Admin_Add_Users.php file exit; } if ($_SERVER['REQUEST_METHOD'] == "POST") { if (TRUE == check_login_status()) { $user_type = get_user_type(); if ($user_type == User_Type::ADMIN) { $user_admin = $_SESSION['Logged_In_User']; $admin_controller = new Admin_Controller($user_admin); if (!isset($_POST['User_ID'])) { $errors[] = "Please go back and refresh the site!"; } else { $User_ID = $_POST['User_ID']; } if (empty($errors)) { $edited = $admin_controller->Delete_User($User_ID); if ($edited) { admin_redirect_success($new_user); } else { admin_redirect_error(Error_Type::DATA_BASE); } } else { admin_redirect_error(Error_Type::FORM); } } } }