prepare("UPDATE ville SET state = ?, time_begin = ? WHERE session = 1"); $req->execute(array(1, time())); header('Refresh: 0'); } if(isset($_POST['start2'])) { $req = $db->prepare("UPDATE ville SET state = ?, time_begin = ? WHERE session = 2"); $req->execute(array(1, time())); header('Refresh: 0'); } //ajout d'une session ville if(isset($_POST['add_session'])){ $req = $db->query("INSERT INTO ville(state,time_begin) VALUES(0,0)"); } // ajout d'une epreuve if(isset($_POST['add_epreuve'])){ $req = $db->prepare("INSERT INTO ville_epreuve(indice,reponse,photo) VALUES(?,?,?)"); $req->execute(array(htmlspecialchars($_POST['indice']),htmlspecialchars($_POST['reponse']),'assets/img/ville/'.htmlspecialchars($_POST['photo']))); } //ajout d'une equipe if(isset($_POST['add_equipe'])){ $req = $db->prepare("INSERT INTO ville_equipe(nom,begin,temps) VALUES(?,?,?)"); $req->execute(array(htmlspecialchars($_POST['nom']),(int) htmlspecialchars($_POST['begin']),NULL)); } if(isset($_POST['stop1'])) { $req = $db->query("UPDATE ville SET state = 2 WHERE session = 1"); header('Refresh: 0'); } if(isset($_POST['stop2'])) { $req = $db->query("UPDATE ville SET state = 2 WHERE session = 2"); header('Refresh: 0'); } if(isset($_POST['reset1'])) { if(htmlspecialchars($_POST['code']) == "anti-missclick") { $req = $db->query("UPDATE ville SET state = 0, time_begin = 0 WHERE session = 1"); $req = $db->query("UPDATE ville_equipe SET temps = NULL WHERE id < 17"); header('Refresh: 0'); } } if(isset($_POST['reset2'])) { if(htmlspecialchars($_POST['code']) == "anti-missclick") { $req = $db->query("UPDATE ville SET state = 0, time_begin = 0 WHERE session = 2"); $req = $db->query("UPDATE ville_equipe SET temps = NULL WHERE id > 16"); header('Refresh: 0'); } } ?> Admin / Com'ville
Session matin Session aprem
query("SELECT state FROM ville WHERE session = 1"); $r = $req -> fetchAll(PDO::FETCH_ASSOC); if($r[0]['state'] == 0) { ?> Session non demarrée,
= 1) { if($r[0]['state'] == 1) { ?> Session en cours,
Session terminée,


"; $reqsession = $db->query("SELECT state, time_begin FROM ville WHERE session = 1"); $rs = $reqsession -> fetchAll(PDO::FETCH_ASSOC); $reqe = $db->query('SELECT * FROM ville_equipe WHERE id < 17'); while($e = $reqe->fetch()) { $temps_init = $e["temps"]; $tab_time = NULL; $tab_time = explode(";", $temps_init); $temps_begin = date("H:i:s",$rs[0]['time_begin']); if($temps_init == NULL) { $avancement = (int) 0; $delta_time_0 = gmdate("H:i:s",time()-$rs[0]['time_begin']); } else { $avancement = count($tab_time); $def_time = $tab_time[$avancement-1] - $rs[0]['time_begin']; $delta_time_0 = gmdate("H:i:s",$tab_time['0']-$rs[0]['time_begin']); } //node 0 ?>
Equipe
0
'; echo $node; if ($i <= $current) { // --:-- doit être remplacé par l'heure à laquelle le point $node a été atteint if($i == $current) { echo '
'.date("H:i:s",time()).'
'; } else { echo '
'.date("H:i:s",$tab_time[$i-1]).'
'; } } echo '
'; if ($i < 17) { echo '
'; if ($i < $current) { if($i < $current-1) { echo '
'.gmdate("H:i:s",$tab_time[$i]-$tab_time[$i-1]).'
'; // --mn doit être remplacé par le deltaT entre les points $node et $node+1 } else { echo '
'.gmdate("H:i:s",time()-$tab_time[$i-1]).'
'; } } echo '
'; } } ?>
Session matin Session aprem
query("SELECT state FROM ville WHERE session = 2"); $r = $req -> fetchAll(PDO::FETCH_ASSOC); if($r[0]['state'] == 0) { ?> Session non demarrée,
= 1) { if($r[0]['state'] == 1) { ?> Session en cours,
Session terminée,


"; $reqsession = $db->query("SELECT state, time_begin FROM ville WHERE session = 2"); $rs = $reqsession -> fetchAll(PDO::FETCH_ASSOC); $reqe = $db->query('SELECT * FROM ville_equipe WHERE id > 16'); while($e = $reqe->fetch()) { $temps_init = $e["temps"]; $tab_time = NULL; $tab_time = explode(";", $temps_init); $temps_begin = date("H:i:s",$rs[0]['time_begin']); if($temps_init == NULL) { $avancement = (int) 0; $delta_time_0 = gmdate("H:i:s",time()-$rs[0]['time_begin']); } else { $avancement = count($tab_time); $def_time = $tab_time[$avancement-1] - $rs[0]['time_begin']; $delta_time_0 = gmdate("H:i:s",$tab_time['0']-$rs[0]['time_begin']); } //node 0 ?>
Equipe
0
'; echo $node; if ($i <= $current) { // --:-- doit être remplacé par l'heure à laquelle le point $node a été atteint if($i == $current) { echo '
'.date("H:i:s",time()).'
'; } else { echo '
'.date("H:i:s",$tab_time[$i-1]).'
'; } } echo '
'; if ($i < 17) { echo '
'; if ($i < $current) { if($i < $current-1) { echo '
'.gmdate("H:i:s",$tab_time[$i]-$tab_time[$i-1]).'
'; // --mn doit être remplacé par le deltaT entre les points $node et $node+1 } else { echo '
'.gmdate("H:i:s",time()-$tab_time[$i-1]).'
'; } } echo '
'; } } ?>
Session matin Session aprem query('SELECT id, indice, reponse, photo FROM ville_epreuve'); while($epreuve = $req->fetch()) { ?>
ID (db) Indice reponse photos
no photos"; }?>