load(); // Configurazione FTP $ftpServer = $_ENV['FTP_HOST']; $ftpUser = $_ENV['FTP_USER']; $ftpPass = $_ENV['FTP_PASSWORD']; // Prendi l'ID dalla query string $invoiceId = $_GET['id']; // Validazione semplificata: deve solo iniziare con "invoice_" e finire con ".pdf" if (!preg_match('/^invoice_.*\.pdf$/', $invoiceId)) { die('Invalid invoice ID'); } // Percorso del file sul NAS $remotePath = "invoices/" . $invoiceId; // Connessione FTP $conn = ftp_connect($ftpServer); if (!$conn) { die('Could not connect to FTP server'); } // Login if (!ftp_login($conn, $ftpUser, $ftpPass)) { die('Could not login to FTP server'); } ftp_pasv($conn, true); if (ftp_size($conn, $remotePath) < 0) { die('Invoice not found: ' . $remotePath); } ?> Thanks for your purchase!
Logo

Thanks for your purchase!

I hope you will enjoy your purchase, once you have downloaded the PDF, you can close this page.

Details

ID:
Data:

Download PDF