getFromDB($id)) { http_response_code(404); exit('Configuration not found'); } $content = $config->getDecryptedContent(); // Opzionale: mascheramento credenziali $content = preg_replace('/(?<=password\s|secret\s|enable\s)[^\s\r\n]+/i', '***REDACTED***', $content); header('Content-Disposition: attachment; filename="netconfig_' . $id . '_' . date('Ymd_His') . '.txt"'); echo $content; exit;