+ header("Expires: ");
+ header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
+ header("Pragma: public");
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
+
+ //header('Content-length: '. filesize($out));
+ header('Content-Disposition: attachment; filename="' . htmlspecialchars(basename($out)). '"');
+ ini_set('display_errors', 0);
+
+ $fh = fopen($out, 'rb');
+ fpassthru($fh);
+
+ fclose($fh);
+
+
+ unlink($out);
+ exit;
+
+
+ }
+
+ function h404($msg)
+ {
+ header("HTTP/1.0 404 Not Found");
+ echo htmlspecialchars($msg);
+ exit;