extranet/www/exportcsv.php

34 lines
953 B
PHP
Raw Normal View History

2009-03-06 17:12:26 +00:00
<?php
//Start...
$page = $_REQUEST['page'];
2009-03-11 07:51:18 +00:00
$idEntreprise = $_REQUEST['idEntreprise'];
2009-03-06 17:12:26 +00:00
$siret = $_REQUEST['siret'];
$siren = substr($siret,0,9);
//Construire le titre du fichier PDF en fonction des param<61>tres fournis
$path = realpath(dirname(__FILE__).'/../cache/');
if (($siret*1)==0 || ($siren*1)<100){
2009-03-06 17:12:26 +00:00
$fileName = $path.'/'.$page.'-'.$idEntreprise;
}else{
$fileName = $path.'/'.$page.'-'.$siret;
2009-03-06 17:12:26 +00:00
}
//Gestion des cas particulier
if($page=='dirigeants' && $_REQUEST['vue']=='histo'){
$fileName.= '-histo';
}
//Ajout de l'extension
$fileName.='.csv';
//Envoi du fichier au navigateur
2009-03-06 17:32:33 +00:00
if (file_exists($fileName)){
$csvNameFile = substr($fileName, strrpos($fileName, "/")+1);
2009-03-06 17:12:26 +00:00
// Write the content type to the client...
//header("Content-type: application/vnd.ms-excel");
header("Content-Type: application/csv-tab-delimited-table");
2009-03-06 17:32:33 +00:00
header("Content-disposition: filename=\"$csvNameFile\"");
2009-03-06 17:12:26 +00:00
flush();
print file_get_contents($fileName);
}
?>