<?php

require_once __DIR__ . '/init_cloud.php';

if (__RB_signedIn() && !empty($_GET['type']) && $_GET['type'] == 'shipping' && file_exists(__DIR__ .'/cloud/user/storage/upload/' . $_GET['id'] . '.pdf') && strpos($_GET['id'], (string)$_SESSION['id']) !== false) {
    header('Content-Type: application/pdf');
    header('Content-Disposition: attachment; filename='. str_replace($_SESSION['id'], '', $_GET['id']) .'.pdf');
    header('Pragma: no-cache');

    readfile(__DIR__ .'/cloud/user/storage/upload/' . $_GET['id'] . '.pdf');
}

exit;