1 |
aurelien |
1 |
<?
|
|
|
2 |
include("../modules/connect.php");
|
|
|
3 |
$contenu = "";
|
|
|
4 |
$entetes = array("Pseudo","ID","Nom","Prenom",
|
|
|
5 |
"Adresse","Commune","E-mail","Mot de passe");
|
|
|
6 |
$requete_utils = mysql_query("select distinct PARTICIPANT_PSEUDO, PARTICIPANT_ID, PARTICIPANT_NOM,PARTICIPANT_PRENOM,CONCAT(PARTICIPANT_ADRESSE,', ',PARTICIPANT_VILLE),PARTICIPANT_CODE_POSTAL,".
|
|
|
7 |
" PARTICIPANT_EMAIL,PARTICIPANT_MOTDEPASSE, PARTICIPANT_DATE_INSCRIPTION ".
|
|
|
8 |
" FROM PARTICIPANT where PARTICIPANT_ADULTE=1 ".
|
|
|
9 |
" ORDER by PARTICIPANT_NOM");
|
|
|
10 |
|
|
|
11 |
$fichierc = implode(';',$entetes).";\n";
|
|
|
12 |
while ($util = mysql_fetch_row($requete_utils)) {
|
|
|
13 |
$fichierc .= implode(';',$util).";\n";
|
|
|
14 |
}
|
|
|
15 |
$fichier = "participants_export.csv";
|
|
|
16 |
$handle = fopen($chemin.$fichier,'w');
|
|
|
17 |
fwrite($handle,$fichierc);
|
|
|
18 |
fclose($handle);
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
$contenue = file_get_contents($fichier);
|
|
|
23 |
$tailledufichier = filesize($fichier);
|
|
|
24 |
|
|
|
25 |
@ob_end_clean();
|
|
|
26 |
@ini_set('zlib.output_compression','Off');
|
|
|
27 |
|
|
|
28 |
header('Pragma: public');
|
|
|
29 |
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
|
|
30 |
header('Cache-Control: must-revalidate, pre-check=0, post-check=0, max-age=0');
|
|
|
31 |
|
|
|
32 |
header('Content-Tranfer-Encoding: none');
|
|
|
33 |
|
|
|
34 |
header('Content-Type: application/octetstream; name="'.$fichier.'"');
|
|
|
35 |
header('Content-Disposition: attachement; filename="'.$fichier.'"');
|
|
|
36 |
|
|
|
37 |
header('Content-Length: '.$tailledufichier);
|
|
|
38 |
|
|
|
39 |
echo $contenue;
|
|
|
40 |
exit();
|
|
|
41 |
?>
|