Subversion Repositories Sites.obs-saisons.fr

Rev

Rev 5 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?
include("../modules/connect.php");

  $contenu = "";
  //$entetes = array("personne_id","personne_nom","personne_email","personne_adulte");
  $requete_utils = mysql_query("select distinct -PARTICIPANT_ID,".
                        "CONCAT_WS(' ',PARTICIPANT_NOM,PARTICIPANT_PRENOM),".
                        //"CONCAT_WS(' ',PARTICIPANT_ADRESSE,COMMUNE_CODEPOSTAL,COMMUNE_NOM),".
                        "COMMUNE_CODEPOSTAL,".
                        "PARTICIPANT_EMAIL from PARTICIPANT LEFT JOIN COMMUNE on PARTICIPANT.COMMUNE_ID=COMMUNE.COMMUNE_ID where PARTICIPANT_ADULTE=1");

  $fichierc = "";
  while ($util = mysql_fetch_row($requete_utils)) {
    $fichierc .= implode(';',$util).";\n";
  }
  $fichier = "participants_export.csv";
  $handle = fopen($chemin.$fichier,'w');
  fwrite($handle,$fichierc);
  fclose($handle);

$contenue        = file_get_contents($fichier);
$tailledufichier = filesize($fichier);

@ob_end_clean();
@ini_set('zlib.output_compression','Off');

header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: must-revalidate, pre-check=0, post-check=0, max-age=0');

header('Content-Tranfer-Encoding: none');

header('Content-Type: application/octetstream; name="'.$fichier.'"');
header('Content-Disposition: attachement; filename="'.$fichier.'"');

header('Content-Length: '.$tailledufichier);

echo $contenue;
exit();
?>