$_POST['password'], "password_two" => $_POST['password_two'] ]; if( $_SESSION['password'] != $data['password'] && $data['password']===$data['password_two']){ //-------------------API CALL--------------------------------// $jsonFilePath = __DIR__ . '/../urls/api_endpoints.json'; $jsonData = file_get_contents($jsonFilePath); $endpoints = json_decode($jsonData, true); $url = $endpoints['change_password'] . $username . "/password?"; //-----------------ENDS HERE-------------------------------------// $response = make_patch_request($url, $data); $_SESSION['password'] = $data['password']; } if ($response === FALSE) { $response = json_encode(['status' => 'error', 'message' => 'An error occurred']); } $response_data = json_decode($response, true); if ($response_data['status'] === 200) { //echo ''; $_SESSION['message']="password changed sucessfully"; $redirect_page="../elements/index.php"; } elseif ($response_data['status'] === 401) { $_SESSION['message'] = 'password not changed'; $redirect_page="../user/user_edit.php"; } else{ $_SESSION['message'] = "password not changed"; $redirect_page="../elements/master.php"; } } else { header('Location: ../index.php'); exit(); } } ?> Create User