<?php
require_once("config.php");
$attid = (isset($_REQUEST["a"]))? $_REQUEST["a"] : 0;
$mid = (isset($_REQUEST["m"]))? $_REQUEST["m"] : 0;
$fname = (isset($_REQUEST["f"]))? $_REQUEST["f"] : 0;
$zipped = isset($_REQUEST["z"])? $_REQUEST["z"] : 0;
if ($attid && $mid && $fname) {
$gm = new GMailer();
quick_init($gm);
if ($gm->connect()) {
header("Content-Type: application/octet-stream");
if ($zipped) {
header('Content-Disposition: attachment; filename="'.$mid.'.zip"');
@$gm->getAttachment($attid, $mid, "php://output", true);
exit();
} else {
header('Content-Disposition: attachment; filename="'.$fname.'"');
@$gm->getAttachment($attid, $mid, "php://output", false);
exit();
}
}
}
echo "Download error.";
?>