<?php
session_start();

if (!isset($_SESSION['phone'])) {
    exit("Unauthorized");
}

if (!isset($_GET['file'])) {
    exit("Invalid request");
}

$file = urldecode($_GET['file']);

if (!file_exists($file)) {
    exit("File not found");
}

header("Content-Type: application/pdf");
header("Content-Disposition: inline; filename=".basename($file));
header("Content-Length: ".filesize($file));
readfile($file);
exit;
