- header('Content-type: text/plain');
- header('Content-Length: '.filesize($filename));
- header("Content-Disposition: inline");
- readfile($filename);
+ header('Content-type: text/plain');
+ header('Content-Length: '.filesize($filename));
+ header("Content-Disposition: inline; filename=".basename($filename));
+ if (substr($filename, -3, 3) == '.gz')
+ header("Content-Encoding: gzip");
+
+ if (substr($filename, -4, 4) == '.zip')
+ echo db_unzip('', $filename);
+ else
+ readfile($filename);