|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* To change this template, choose Tools | Templates
|
|
|
|
|
* and open the template in the editor.
|
|
|
|
|
*/
|
|
|
|
|
$fileExist = 0;
|
|
|
|
|
$tpLayout = 1;
|
|
|
|
|
$path_som = $_SESSION["path_som"];
|
|
|
|
|
$ppId = $_GET["pp_id"];
|
|
|
|
|
$sauda = isset($_GET["sauda"]) ? 1 : 0;
|
|
|
|
|
$pqId = isset($_GET["pq_id"]) ? $_GET["pq_id"] : 0;
|
|
|
|
|
$fileDisp = '';
|
|
|
|
|
|
|
|
|
|
$dir = VerificaCharFinal($path_som) . "mp3/";
|
|
|
|
|
|
|
|
|
|
if ($pqId) {
|
|
|
|
|
$filepath = sprintf('%spesquisa_questao_%s_%s.mp3', $dir, $ppId, $pqId);
|
|
|
|
|
$fileDisp = sprintf('pesquisa_questao_%s_%s.mp3', $ppId, $pqId);
|
|
|
|
|
} else {
|
|
|
|
|
$filepath = sprintf('%spesquisa_audio_%s_%s.mp3', $dir, ($sauda ? "sauda" : "encerra"), $ppId);
|
|
|
|
|
$fileDisp = sprintf('pesquisa_audio_%s_%s.mp3', ($sauda ? "sauda" : "encerra"), $ppId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (@file_exists($filepath)) {
|
|
|
|
|
$fileExist = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$fileExist) {
|
|
|
|
|
if (@file_exists($filepath)) {
|
|
|
|
|
$fileExist = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$fileExist) {
|
|
|
|
|
$jsStartup[] = "alert('Arquivo n<EFBFBD>o encontrado!'); window.close();";
|
|
|
|
|
} else {
|
|
|
|
|
ob_clean();
|
|
|
|
|
header("Pragma: public");
|
|
|
|
|
header('Cache-Control: no-cache, must-revalidate');
|
|
|
|
|
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
|
|
|
|
//header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime( $filepath )) . ' GMT');
|
|
|
|
|
header('Accept-Ranges: bytes');
|
|
|
|
|
header('Content-Type: ' . GetMimeContentType($fileDisp));
|
|
|
|
|
header('Content-Disposition: attachment; filename="' . $fileDisp . '";');
|
|
|
|
|
header('Content-Transfer-Encoding: binary');
|
|
|
|
|
header('Content-Length: ' . filesize($filepath));
|
|
|
|
|
header('Connection: close');
|
|
|
|
|
readfile($filepath);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
?>
|