site de Fabien Torre


Source de biblimsm.php

<?php

// pour empecher l'utilisation directe

header("HTTP/1.0 404 Not Found");
exit;

// Constantes pour la connexion à la base de données

define('SERVEUR','sql.free.fr');
define('NOMBASE','msm.lille');
define('UTILISATEUR','msm.lille');
define('MOTDEPASSE','********');





// Procédure d'affichage d'un début de page du site

function DebutPage ($titre) {

  echo "<HTML>\n";
  echo "<HEAD>\n";
  echo "<TITLE>$titre</TITLE>\n";
  echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"msmlille.css\">\n";
  echo "</HEAD>\n";
  echo "<BODY>\n";
  echo "<H1>$titre</H1>\n";


}



// Procédure d'affichage d'un début de page du site

function PiedPage () {


  echo "</BODY>\n";
  echo "</HTML>\n";


}



// Procédure d'affichage d'un lieu

function AfficheLieu ($lieu) {

  echo "<BR><BR>\n";
  echo '<div align="left"><font size="5" color="#990000"><b>';
  echo $lieu['nom'];
  echo "</b></font></div>\n";

  echo "<blockquote><p>Type :\n";
  echo $lieu['intitule_type'];
  echo "</p></blockquote>\n";

  echo "<blockquote><p>Quartier :\n";
  echo $lieu['nom_quartier'];
  echo "</p></blockquote>\n";

  echo "<blockquote><p>Métro :\n";
  echo $lieu['nom_station'];
  echo "</p></blockquote>\n";

  echo "<blockquote><p>Adresse :\n";
  echo $lieu['adresse'];
  echo "</p></blockquote>\n";

  echo "<blockquote>\n";
  echo "<p><font color=\"#666699\">\n";
  echo preg_replace("/\n\s*\n/","<P>",$lieu['description']);
  echo "</font></p>\n";
  echo "</blockquote>\n";

  echo "<blockquote>\n";
  echo '<p><a href="';
  echo $lieu['url'];
  echo '">';
  echo $lieu['url'];
  echo "</a></p>\n";
  echo "</blockquote>\n";

}


// Affiche une question avec sa réponse ou non

function AfficheQuestion($numero,$question,$possibilites,$solution) {

  echo "<tr>\n";
  echo "<td height=\"23\" width=\"25\">&nbsp;</td>\n";
  echo "<td height=\"23\"><span class=\"numquestion\">Question $numero </span></td>\n";
  echo "</tr>\n";

  echo "<tr>\n";
  echo "<td width=\"25\">&nbsp;</td>\n";
  echo "<td><span class=\"question\">\n";
  echo $question['formulation'];
  echo "</span> </td>\n";
  echo "</tr>\n";

  for ($i=0 ; $i<sizeof($possibilites) ; $i++) {

    echo "<tr>\n"; 
    echo "<td width=\"25\">\n"; 
    if ($solution) {
      if ($possibilites[$i]['id'] == $question['reponse']) {
    echo "<img src=\"bonnereponse.gif\" width=\"25\" height=\"25\">\n"; 
      } else {
    echo "<img src=\"bad.gif\" width=\"25\" height=\"25\">\n"; 
      }
    }
    echo "</td>\n"; 
    echo "<td><span class=\"réponse\">\n"; 
    echo $possibilites[$i]['texte'];
    echo "</span></td>\n"; 
    echo "</tr>\n"; 

  }


  echo "<tr>\n";
  echo "<td width=\"25\">&nbsp;</td>\n";
  echo "<td></td>\n";
  echo "</tr>\n";

}




// Affiche une question sous forme d'élément de formulaire HTML

function PoseQuestion($numero,$question,$possibilites) {

  echo "<tr>\n";
  echo "<td height=\"23\" width=\"25\">&nbsp;</td>\n";
  echo "<td height=\"23\"><span class=\"numquestion\">Question $numero </span></td>\n";
  echo "</tr>\n";

  echo "<tr>\n";
  echo "<td width=\"25\">&nbsp;</td>\n";
  echo "<td><span class=\"question\">\n";
  echo $question['formulation'];
  echo "</span> </td>\n";
  echo "</tr>\n";

  for ($i=0 ; $i<sizeof($possibilites) ; $i++) {

    echo "<tr>\n";
    echo "<td width=\"25\" height=\"16\">&nbsp;</td>\n";
    echo "<td height=\"16\"><span class=\"réponse\">\n";

    echo '<INPUT TYPE="radio" NAME="q'.$question['id'].'" VALUE="'.$possibilites[$i]['id'].'"> ';
    echo $possibilites[$i]['texte'];

    echo "</span>\n";
    echo "</td>\n";
    echo "</tr>\n";

  }

  echo "<tr>\n";
  echo "<td width=\"25\">&nbsp;</td>\n";
  echo "<td></td>\n";
  echo "</tr>\n";

}

?>

site de Fabien Torre, université de Lille