query($sql); $input_json = $result->fetch_assoc()['input_json']; $input_json_array = []; if (!empty($input_json)) { $input_json_array = json_decode($input_json, true); } if (!empty($input_json_array) && !empty($refresh_token)) { $input_json_array['dropbox_refresh_token'] = $refresh_token; } $final_result = "Your dropbox cannot authorize successfully"; if ($json_data = json_encode($input_json_array)) { $sql = "UPDATE `automations` SET `input_json`='$json_data' WHERE id = " . $_SESSION['db_id']; if ($conn->query($sql)) { $final_result = "Your dropbox has authorized successfully"; unset($_SESSION['dropbox_app_key']); unset($_SESSION['dropbox_app_secret']); } } } echo $final_result; exit; } } catch (\Exception $ex) { $final_result = $ex->getMessage(); } echo $final_result; exit;