q("SELECT * FROM `_sys_files` WHERE `id` = '".intval($_GET['id'])."' AND `private` = 0 "); if ($core_db->r()) { header('Content-Disposition: attachment; filename=' . $core_db->f('realname')); header('Content-type: ' . $core_db->f('ext')); die(file_get_contents(_FILES_DIR_ . $core_db->f('filename'))); } else { $transparentPixelGif = 'R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; header('Content-type: image/gif'); header('Content-Disposition: attachment; filename=empty.gif'); die(base64_decode($transparentPixelGif)); }