Merge branch 'master' of ssh://git@localhost/cl7
[cl7.git] / php / panel.php
1 <?php # coding:utf-8
2
3 include_once("traitement_pre_affichage.php");
4
5 /**
6 * Représente le panel latéral contenant la liste des inscrits,
7 * la boite de login et d'autres informations.
8 */
9 class Panel
10 {
11 private $participant;
12
13 function Panel($participant)
14 {
15 $this->participant = $participant;
16 }
17
18 function rendre()
19 {
20 # selection de tous les participants
21 $res_SQL = mysql_query("SELECT pseudo FROM participants ORDER BY id");
22
23 echo '<div id="nbParticipants"><em>', mysql_num_rows($res_SQL), '</em> inscrit', (mysql_num_rows($res_SQL) > 1 ? 's' : ''), '</div>';
24
25 # affichage des participants
26 if (mysql_num_rows($res_SQL) > 0)
27 echo '<ul id="participants">';
28 for ($i=0; $i<mysql_num_rows($res_SQL); $i++)
29 {
30 mysql_data_seek($res_SQL, $i);
31 $le_participant_pseudo = mysql_fetch_object($res_SQL);
32 echo '<li>', traitement_pre_affichage($le_participant_pseudo->pseudo, 8), '</li>';
33 }
34 if (mysql_num_rows($res_SQL) > 0)
35 echo '</ul>';
36
37 if($this->participant->valide)
38 {
39 echo'
40 <form method="post" action="index.php?';
41
42 foreach($_GET as $nom => $valeur)
43 echo $nom,'=',$valeur,'&amp;';
44
45 echo'">
46 <p><input type="hidden" name="effacer_cookie" value="1" /></p>
47 <p><input type="submit" value="logout" /></p>
48 </form>';
49 }
50 else
51 {
52 echo'
53 <form method="post" action="index.php?';
54
55 foreach($_GET as $nom => $valeur)
56 echo $nom,'=',$valeur,'&amp;';
57
58 echo'">
59 <p>login / pass</p>
60 <p><input type="hidden" name="log" value="1" /></p>
61 <p><input type="text" name="pseudo" size="10" maxlength="30" /></p>
62 <p><input type="password" name="password" size="10" maxlength="10" /></p>
63 <p><input type="submit" value="oki" class="submitInvisible" /></p>
64 </form>
65 ';
66 }
67 }
68 }
69 ?>