keys->key; $key_found = false; foreach($keys as $key) { if($key == $_GET['key']) { $key_found = true; break; } } // Not allowed? if(!$key_found) { exit(T_("The key you provided does not have the permission to download this file")); } // Generate header data $expires = 31536000; $filename = $xml->name; $mimetype = $xml->type; // Cache headers header('Pragma: public'); header('Cache-Control: maxage='.$expires); header('Expires: '.gmdate('D, d M Y H:i:s', (time() + $expires)).' GMT'); // Content headers header('Content-Type: '.$mimetype); header('Content-Disposition: attachment; filename="'.htmlspecialchars($filename).'"'); header('Content-Length: '.filesize($file_path)); // Output data exit(file_get_contents($file_path)); ?>