Subversion Repositories Sites.obs-saisons.fr

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 aurelien 1
<?
2
include("../modules/connect.php");
3
  $contenu = "";
4
  $entetes = array("Pseudo","Type inscription","Ecole","Niveau","Nom","Prenom",
5
	"Adresse","Commune","E-mail","Mot de passe");
6
  $requete_utils = mysql_query("select distinct PARTICIPANT_PSEUDO,TYPE_INSCRIPTION_NOM,PARTICIPANT_ECOLE,".
7
                        "NIVEAU_NOM,PARTICIPANT_NOM,PARTICIPANT_PRENOM,CONCAT(PARTICIPANT_ADRESSE,', ',COMMUNE_NOM),COMMUNE_CODEPOSTAL,".
8
                        "PARTICIPANT_EMAIL,PARTICIPANT_MOTDEPASSE, PARTICIPANT_DATE_INSCRIPTION from PARTICIPANT,NIVEAU,TYPE_INSCRIPTION,COMMUNE ".
9
			"where NIVEAU.NIVEAU_ID=PARTICIPANT.NIVEAU_ID and COMMUNE.COMMUNE_ID=PARTICIPANT.COMMUNE_ID ".
10
			"and TYPE_INSCRIPTION.TYPE_INSCRIPTION_ID=PARTICIPANT.TYPE_INSCRIPTION_ID ".
11
			"and PARTICIPANT.TYPE_INSCRIPTION_ID=1 and PARTICIPANT_ADULTE=0 ".
12
			"order by PARTICIPANT.COMMUNE_ID,PARTICIPANT_NOM");
13
  $fichierc = implode(';',$entetes).";\n";
14
  while ($util = mysql_fetch_row($requete_utils)) {
15
    $fichierc .= implode(';',$util).";\n";
16
  }
17
  $fichier = "participants_export.csv";
18
  $handle = fopen($chemin.$fichier,'w');
19
  fwrite($handle,$fichierc);
20
  fclose($handle);
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
?>