forked from rebillar/site-accueil-insa
repérage des diverses ameliorations à faire
This commit is contained in:
parent
4125628e97
commit
2dd09f95db
3 changed files with 38 additions and 7 deletions
|
@ -10,20 +10,38 @@ if($user['perm'] < 3) {
|
||||||
$req = $db->query("SELECT * FROM enigma WHERE id = 1");
|
$req = $db->query("SELECT * FROM enigma WHERE id = 1");
|
||||||
$r = $req -> fetchAll(PDO::FETCH_ASSOC);
|
$r = $req -> fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Le principe est qu'une seule énigme est émise en même temps,
|
||||||
|
il s'agit de la même pour les deux équipes.
|
||||||
|
D'où le fait que l'id de l'entrée est hardcode à 1.
|
||||||
|
|
||||||
|
La série de if est faite pour n'avoir qu'a remplir la/les colonne(s) dans l'interface
|
||||||
|
que l'on souhaite modifier dans la BDD.
|
||||||
|
*/
|
||||||
|
|
||||||
if(isset($_POST['send'])) {
|
if(isset($_POST['send'])) {
|
||||||
|
|
||||||
|
// on vérifie les privilèges de l'utilisateur
|
||||||
if($user['perm'] >= 3) {
|
if($user['perm'] >= 3) {
|
||||||
|
|
||||||
|
|
||||||
if(isset($_POST['answer']) AND !empty($_POST['answer'])) {
|
if(isset($_POST['answer']) AND !empty($_POST['answer'])) {
|
||||||
$ans = htmlspecialchars($_POST['answer']);
|
$ans = htmlspecialchars($_POST['answer']);
|
||||||
$req = $db->prepare("UPDATE enigma SET answer = ? WHERE id = 1");
|
$req = $db->prepare("UPDATE enigma SET answer = ? WHERE id = 1");
|
||||||
$req->execute(array($ans));
|
$req->execute(array($ans));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST['points']) AND !empty($_POST['points'])) {
|
if(isset($_POST['points']) AND !empty($_POST['points'])) {
|
||||||
$point = (int) htmlspecialchars($_POST['points']);
|
$point = (int) htmlspecialchars($_POST['points']);
|
||||||
$req = $db->prepare("UPDATE enigma SET point = ? WHERE id = 1");
|
$req = $db->prepare("UPDATE enigma SET point = ? WHERE id = 1");
|
||||||
$req->execute(array($point));
|
$req->execute(array($point));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST['team']) AND !empty($_POST['team'])) {
|
if(isset($_POST['team']) AND !empty($_POST['team'])) {
|
||||||
switch (htmlspecialchars($_POST['team'])) {
|
switch (htmlspecialchars($_POST['team'])) {
|
||||||
|
|
||||||
|
// le cas "t" est lorsque aucune équipe n'a encore trouvé
|
||||||
case "t":
|
case "t":
|
||||||
$t_int = NULL;
|
$t_int = NULL;
|
||||||
break;
|
break;
|
||||||
|
@ -53,11 +71,13 @@ if(isset($_POST['send'])) {
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="texte" name="answer" placeholder="answer" class="input_inline">
|
<input type="texte" name="answer" placeholder="answer" class="input_inline">
|
||||||
<input type="number" name ="points" placeholder="points" class="input_inline">
|
<input type="number" name ="points" placeholder="points" class="input_inline">
|
||||||
<select name="team" class="input_inline">
|
<select name="team" class="input_inline" id="team">
|
||||||
<option value="t">NULL</option>
|
<option value="t">AUCUNE EQUIPE</option>
|
||||||
<option value="t0"><?=$TEAM1?></option>
|
<option value="t0"><?=$TEAM1?></option>
|
||||||
<option value="t1"><?=$TEAM2?></option>
|
<option value="t1"><?=$TEAM2?></option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<label for="team">Equipe ayant trouvé l'énigme.</label>
|
||||||
<input type="submit" name="send" value="Mettre à jour" class="submit_inline">
|
<input type="submit" name="send" value="Mettre à jour" class="submit_inline">
|
||||||
</form>
|
</form>
|
||||||
<table class="acces">
|
<table class="acces">
|
||||||
|
@ -71,7 +91,8 @@ if(isset($_POST['send'])) {
|
||||||
<td><?= $r[0]['id'] ?></td>
|
<td><?= $r[0]['id'] ?></td>
|
||||||
<td><?= $r[0]['answer'] ?></td>
|
<td><?= $r[0]['answer'] ?></td>
|
||||||
<td><?= $r[0]['point'] ?></td>
|
<td><?= $r[0]['point'] ?></td>
|
||||||
<td><?php
|
<td>
|
||||||
|
<?php
|
||||||
switch ($r[0]['team']) {
|
switch ($r[0]['team']) {
|
||||||
case "0":
|
case "0":
|
||||||
echo $TEAM1;
|
echo $TEAM1;
|
||||||
|
|
|
@ -5,6 +5,9 @@ include "script.php";
|
||||||
require_once("../phpCAS-1.3.6/CAS.php");
|
require_once("../phpCAS-1.3.6/CAS.php");
|
||||||
|
|
||||||
$_SESSION['id']=1;
|
$_SESSION['id']=1;
|
||||||
|
$pseudo = "mougnibas";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Initialize phpCAS
|
// Initialize phpCAS
|
||||||
phpCAS::client(CAS_VERSION_2_0, "cas.insa-toulouse.fr", 443, 'cas', true);
|
phpCAS::client(CAS_VERSION_2_0, "cas.insa-toulouse.fr", 443, 'cas', true);
|
||||||
|
|
|
@ -53,7 +53,14 @@ if(isset($_POST['reset2'])) {
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
TODO : FAIRE UN SCRIPT POUR AJOUTER DES EPREUVES ET EQUIPES DEPUIS LE PANEAU D'ADMIN
|
||||||
|
*/
|
||||||
if(isset($_GET['session']) AND !empty($_GET['session']))
|
if(isset($_GET['session']) AND !empty($_GET['session']))
|
||||||
{
|
{
|
||||||
$session = (int) htmlspecialchars($_GET['session']);
|
$session = (int) htmlspecialchars($_GET['session']);
|
||||||
|
@ -68,7 +75,7 @@ if(isset($_POST['reset2'])) {
|
||||||
|
|
||||||
if($r[0]['state'] == 0) {
|
if($r[0]['state'] == 0) {
|
||||||
?>
|
?>
|
||||||
<font color="green">Session non demarré, </font>
|
<font color="green">Session non demarrée, </font>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="submit" name="start1" value="Démarrer la session" class="submit_inline"></form>
|
<input type="submit" name="start1" value="Démarrer la session" class="submit_inline"></form>
|
||||||
</form>
|
</form>
|
||||||
|
@ -86,7 +93,7 @@ if(isset($_POST['reset2'])) {
|
||||||
<?php
|
<?php
|
||||||
} elseif($r[0]['state'] == 2) {
|
} elseif($r[0]['state'] == 2) {
|
||||||
?>
|
?>
|
||||||
<font color="red">Session terminé, </font>
|
<font color="red">Session terminée, </font>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="text" name="code" placeholder="anti-missclick" class="input_inline">
|
<input type="text" name="code" placeholder="anti-missclick" class="input_inline">
|
||||||
<input type="submit" name="reset1" value="Reset la session" class="submit_inline"></form>
|
<input type="submit" name="reset1" value="Reset la session" class="submit_inline"></form>
|
||||||
|
@ -224,7 +231,7 @@ if(isset($_POST['reset2'])) {
|
||||||
|
|
||||||
if($r[0]['state'] == 0) {
|
if($r[0]['state'] == 0) {
|
||||||
?>
|
?>
|
||||||
<font color="green">Session non demarré, </font>
|
<font color="green">Session non demarrée, </font>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="submit" name="start2" value="Démarrer la session" class="submit_inline"></form>
|
<input type="submit" name="start2" value="Démarrer la session" class="submit_inline"></form>
|
||||||
</form>
|
</form>
|
||||||
|
@ -242,7 +249,7 @@ if(isset($_POST['reset2'])) {
|
||||||
<?php
|
<?php
|
||||||
} elseif($r[0]['state'] == 2) {
|
} elseif($r[0]['state'] == 2) {
|
||||||
?>
|
?>
|
||||||
<font color="red">Session terminé, </font>
|
<font color="red">Session terminée, </font>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="text" name="code" placeholder="anti-missclick" class="input_inline">
|
<input type="text" name="code" placeholder="anti-missclick" class="input_inline">
|
||||||
<input type="submit" name="reset2" value="Reset la session" class="submit_inline"></form>
|
<input type="submit" name="reset2" value="Reset la session" class="submit_inline"></form>
|
||||||
|
|
Loading…
Reference in a new issue