Rev 1 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?
include("../modules/connect.php");
$contenu = "";
$entetes = array("Pseudo","Type inscription","Ecole","Niveau","Nom","Prenom",
"Adresse","Commune","E-mail","Mot de passe");
$requete_utils = mysql_query("select distinct PARTICIPANT_PSEUDO,TYPE_INSCRIPTION_NOM,PARTICIPANT_ECOLE,".
"NIVEAU_NOM,PARTICIPANT_NOM,PARTICIPANT_PRENOM,CONCAT(PARTICIPANT_ADRESSE,', ',COMMUNE_NOM),COMMUNE_CODEPOSTAL,".
"PARTICIPANT_EMAIL,PARTICIPANT_MOTDEPASSE, PARTICIPANT_DATE_INSCRIPTION from PARTICIPANT,NIVEAU,TYPE_INSCRIPTION,COMMUNE ".
"where NIVEAU.NIVEAU_ID=PARTICIPANT.NIVEAU_ID and COMMUNE.COMMUNE_ID=PARTICIPANT.COMMUNE_ID ".
"and TYPE_INSCRIPTION.TYPE_INSCRIPTION_ID=PARTICIPANT.TYPE_INSCRIPTION_ID ".
"and PARTICIPANT.TYPE_INSCRIPTION_ID=1 and PARTICIPANT_ADULTE=0 ".
"order by PARTICIPANT.COMMUNE_ID,PARTICIPANT_NOM");
$fichierc = implode(';',$entetes).";\n";
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();
?>