isLoggedIn()) { header("X-Sendfile: $path_to_somefile"); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"$somefile\""); exit; } ?>

Permission denied

Login first!