52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
$PARENT_SCRIPTNAME='rep_financial.php';
|
|
//include_once 'init/initialisation_parameter.php';
|
|
|
|
if ( ! function_exists ( 'mime_content_type ' ) ) {
|
|
function mime_content_type ( $f ) {
|
|
return trim ( exec ('file -bi ' . escapeshellarg ( $f ) ) ) ;
|
|
}
|
|
}
|
|
|
|
ob_start();
|
|
include_once 'script_auth.php';
|
|
|
|
start_serving_file();
|
|
|
|
ob_end_flush();
|
|
|
|
function start_serving_file() {
|
|
$tahun = substr($_REQUEST['TGL_POS'], 6,4);
|
|
$bulan = substr($_REQUEST['TGL_POS'], 3,2);
|
|
$tanggal = substr($_REQUEST['TGL_POS'], 0,2);
|
|
$tglfile = $tahun.$bulan.$tanggal;
|
|
$real_path = "{$_SERVER['DOCUMENT_ROOT']}/Data";
|
|
//$real_path = LH_FOLDER;
|
|
//$web_path = LH_FOLDER;
|
|
$request_filename = "LH_$tglfile.PDF";
|
|
$request_file = "$real_path/$request_filename";
|
|
//echo $request_file;
|
|
|
|
if (file_exists($request_file)) {
|
|
$serve_filename = "$request_filename";
|
|
$data = file_get_contents($request_file);
|
|
if (!is_null($data)) {
|
|
$type = mime_content_type($request_file);
|
|
$size = filesize($request_file);
|
|
|
|
header ("Content-type: $type");
|
|
header ("Content-length: {$size}");
|
|
//header ("Content-Disposition: attachment; filename=$serve_filename");
|
|
header ("Content-Description: PHP Generated Data");
|
|
echo $data;
|
|
} else {
|
|
die("Unable to open the file. Please contact the webmaster.");
|
|
}
|
|
} else {
|
|
die ("The request file '{$request_filename}' not found.");
|
|
}
|
|
}
|
|
|
|
?>
|