Valid XHTML    Valid CSS2    

Listing du fichier l2aprog08.php

 

00001     <?php
00002     
include("std.php") ;
00003     
# (gH) -_- l2aprog04.php ; TimeStamp (unix) : 07 Mars 2013 vers 17:58
00004     
00005     
error_reporting
(E_ALL | E_NOTICE | E_STRICT ) ;
00006     
00007     
###########################################################################
00008     # #
00009     # exemple de programme php pour le cours Développement Web Avancé en L2 #
00010     # #
00011     ###########################################################################
00012     # #
00013     # #
00014     # Lecture de fichiers #
00015     # #
00016     # #
00017     ###########################################################################
00018     
00019     
00020     # voici le code qui génére l'extrait de code pour le tableau du controle continu
00021     
00022     
$fh
= @fopen("l2grps_2013.txt","r") ;
00023     if (!
$fh) {
00024     
h3
("Fichier des étudiants non vu.") ;
00025     } else {
00026     
blockquote() ;
00027     
00028     
table
(1,15,"collapse sortable") ;
00029     
tr() ;
00030     
th
() ; echo "Groupe " ; finth() ;
00031     
th
() ; echo "Nom + lien CV " ; finth() ;
00032     
th
() ; echo "Prénom " ; finth() ;
00033     
th
() ; echo "Archive " ; finth() ;
00034     
th
() ; echo "Simulation (kO)" ; finth() ;
00035     
fintr() ;
00036     
$grp
= "???" ;
00037     
$ogrp
= "???" ;
00038      while (
$lig
=fgets($fh,4096)) { # 4096 est la taille du buffer car ...
00039      # on saute les lignes vides et celles qui commencent par dièse
00040     
if ((
strlen(trim($lig))>0) and (substr($lig."???",0,1)!="#")) {
00041     
# on affecte éventuellement le groupe
00042     
$m1
= mot($lig,1) ;
00043      if (
$m1
=="Groupe") {
00044     
$grp
= mot($lig,2) ;
00045     
$ogrp
= $grp ;
00046      } else {
00047     
$grp
= $ogrp ;
00048     
$login
= mot($lig,1) ;
00049     
$nom
= mot($lig,2) ;
00050     
$prenom
= mot($lig,3) ;
00051     
# on lit login nom prénom et on construit l'URL et le nom de l'archive
00052      # et on simule une taille d'archive
00053     
$url1
= "http://forge.info.univ-angers.fr/~".$login."/cv_index.php" ;
00054     
$archive
= $login.".zip" ;
00055     
$url2
= "http://forge.info.univ-angers.fr/~".$login."/".$archive ;
00056     
$simule
= rand(15,130) ;
00057     
tr() ;
00058     
th
("R","tajaunec") ; echo $grp."&nbsp;&nbsp;" ; finth() ;
00059     
th
() ; echo href($url1,$nom,"gbleuf nou") ; finth() ;
00060     
th
() ; echo $prenom ; finth() ;
00061     
th
("","orange_pastel") ; echo href($url2,$archive,"gvertf nou") ; finth() ;
00062     
th
("R","bleu_pastel") ; echo $simule."&nbsp;&nbsp;" ; finth() ;
00063     
fintr() ;
00064      } ;
# fin si
00065     
} ; # fin si
00066     
} ; # fin de tant que
00067     
fclose
($fh) ;
00068     
fintable() ;
00069     
00070     
finblockquote() ;
00071     } ;
# fin si
00072     
00073     
?>

Pour ne pas voir les numéros de ligne, ajoutez &nl=non à la suite du nom du fichier.

 

 

retour gH    Retour à la page principale de   (gH)