affichage team

This commit is contained in:
Baptiste 2022-07-25 21:00:56 +02:00
parent 6d4db33382
commit 0ad564e2f1
2 changed files with 111 additions and 0 deletions

View file

@ -9,3 +9,22 @@ section {
font-size: 1.2rem;
margin-top: 40px;
}
a.team {
display: block;
color: black;
padding: 10px;
margin: auto;
margin-top: 10px;
background-color: white;
width: 50%;
text-decoration: none;
border: 2px solid white;
}
a.team:hover {
text-decoration: underline;
text-decoration-color: red;
transition: 0.3s ease-out;
border: 2px solid red;
}

View file

@ -1,6 +1,33 @@
<?php
ob_start(); // Start reading html
include "assets/fonts/color.php";
include "script/db.php";
if(isset($_GET['team']) AND !empty($_GET['team']))
{
$team = (int) htmlspecialchars($_GET['team']);
$req = $db->prepare("SELECT id FROM ville_equipe WHERE id = ?");
$req->execute(array($team));
$rc = $req->rowcount();
$r = $req -> fetchAll(PDO::FETCH_ASSOC);
if($rc == 1) {
if($r[0]['id'] < 17) {
$session = 1;
} else {
$session = 2;
}
$reqtest = $db->prepare("SELECT state FROM ville WHERE session = ?");
$reqtest->execute(array($session));
$rtest = $reqtest -> fetchAll(PDO::FETCH_ASSOC);
if($rtest[0]['state']<1 OR $rtest[0]['state']>2 ) {
header('Location: error.php');
}
} else {
header('Location: error.php');
}
}
?>
<main>
<div class="box-jaune">
@ -21,6 +48,71 @@ include "assets/fonts/color.php";
<?= colored_text("*saute*") ?><br>
Insert “mouhahahaahaaa” diabolique mario
</section>
<?php
$req = $db->query("SELECT state FROM ville WHERE session = 1");
$r = $req -> fetchAll(PDO::FETCH_ASSOC);
if($r[0]['state'] == 0) {
?>
<section>
<h1>Session matin</h1>
<font color="red">La session n'a pas commencé</font>
</section>
<?php
} elseif($r[0]['state'] == 1) {
?>
<section>
<h1>Session matin</h1>
<font color="orange">La session est en cours</font><br><br>
<?php
$reqint = $db->query('SELECT id, nom FROM ville_equipe WHERE id < 17');
while($equipe = $reqint->fetch()) {
echo "<a href='com_ville.php?team=".$equipe["id"]."' class='team'>Equipe ".$equipe["nom"]."</a>";
}
?>
</section>
<?php
} elseif($r[0]['state'] == 2) {
?>
<section>
<h1>Session matin</h1>
<font color="black">La session est terminé</font>
</section>
<?php
}
$req = $db->query("SELECT state FROM ville WHERE session = 2");
$r = $req -> fetchAll(PDO::FETCH_ASSOC);
if($r[0]['state'] == 0) {
?>
<section>
<h1>Session aprem</h1>
<font color="red">La session n'a pas commencé</font>
</section>
<?php
} elseif($r[0]['state'] == 1) {
?>
<section>
<h1>Session aprem</h1>
<font color="orange">La session est en cours</font><br><br>
<?php
$reqint = $db->query('SELECT id, nom FROM ville_equipe WHERE id > 16');
while($equipe = $reqint->fetch()) {
echo "<a href='com_ville.php?team=".$equipe["id"]."' class='team'>Equipe ".$equipe["nom"]."</a>";
}
?>
</section>
<?php
} elseif($r[0]['state'] == 2) {
?>
<section>
<h1>Session aprem</h1>
<font color="black">La session est terminé</font>
</section>
<?php
}
?>
</main>
<?php
$infopage = ["", "Com'ville", ob_get_clean(), "", "com_ville"]; //relativepath, pagetitle, pagecontent, pagescript, pagename | cf structure/template.php ligne 2 à 6