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');
}
}
?>