open-textures
clone your own copy | download snapshot

Snapshots | iceberg

No images in this repository’s iceberg at this time

Inside this repository

secure_image.php
text/x-php

Download raw (398 bytes)

<?php
// secure_image.php

$path = $_GET['p'];
$hash = $_GET['h'];


if(file_exists($path))
{
    $sum = md5_file($path);
    if($hash === $sum)
    {
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        $mt = finfo_file($finfo, $path);
        header("Content-length: ".filesize($path));
        header("Content-type: " . $mt);
        readfile($path);
        finfo_close($finfo);
    }
}

?>