What are the advantages and disadvantages of using PHP to control access to downloadable files based on the referring URL?

When controlling access to downloadable files based on the referring URL, the advantage of using PHP is that it allows for dynamic and customizable access control logic. However, a disadvantage is that relying solely on the referring URL for access control can be easily manipulated or spoofed.

<?php
$allowed_referrer = 'https://example.com'; // Set the allowed referring URL
$referrer = $_SERVER['HTTP_REFERER']; // Get the referring URL

if($referrer != $allowed_referrer){
    header('HTTP/1.0 403 Forbidden');
    echo 'Access Denied';
    exit;
}

// Code to serve the downloadable file here
?>