finally global team variables :')

This commit is contained in:
thaaoblues 2023-01-26 15:53:45 +01:00
parent ae163eded6
commit 74828cfd32
11 changed files with 65 additions and 36 deletions

View file

@ -1,6 +1,8 @@
<?php <?php
include "script.php"; include "script.php";
include "assets/scripts/globals.php"
if($user['perm'] < 3) { if($user['perm'] < 3) {
header('Location: deco.php'); header('Location: deco.php');
} }
@ -53,8 +55,8 @@ if(isset($_POST['send'])) {
<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">
<option value="t">NULL</option> <option value="t">NULL</option>
<option value="t0">team1</option> <option value="t0"><?=$TEAM1?></option>
<option value="t1">team2</option> <option value="t1"><?=$TEAM2?></option>
</select> </select>
<input type="submit" name="send" value="Mettre à jour" class="submit_inline"> <input type="submit" name="send" value="Mettre à jour" class="submit_inline">
</form> </form>
@ -72,10 +74,10 @@ if(isset($_POST['send'])) {
<td><?php <td><?php
switch ($r[0]['team']) { switch ($r[0]['team']) {
case "0": case "0":
echo "team1"; echo $TEAM1;
break; break;
case "1": case "1":
echo "team2"; echo $TEAM2;
break; break;
} }
?></td> ?></td>

View file

@ -1,6 +1,8 @@
<?php <?php
include "script.php"; include "script.php";
include "assets/scripts/globals.php"
$req = $db->query('SELECT id, texte, points, team, id_staff FROM scores'); $req = $db->query('SELECT id, texte, points, team, id_staff FROM scores');
@ -73,8 +75,8 @@ if(isset($_POST['send'])) {
<input type="text" placeholder="Texte" name="texte" class="input_inline"> <input type="text" placeholder="Texte" name="texte" class="input_inline">
<input type="number" placeholder="point" name="point" class="input_inline"> <input type="number" placeholder="point" name="point" class="input_inline">
<select name="team" class="input_inline"> <select name="team" class="input_inline">
<option value="t0">team1</option> <option value="t0"><?=$TEAM1?></option>
<option value="t1">team2</option> <option value="t1"><?=$TEAM1?></option>
</select> </select>
<input type="submit" name="send" value="Ajouter" class="submit_inline"> <input type="submit" name="send" value="Ajouter" class="submit_inline">
</form> </form>
@ -86,8 +88,8 @@ if(isset($_POST['send'])) {
<br><br> <br><br>
<form method="POST"> <form method="POST">
<input type="submit" name="teamall" value="All" class="submit_inline"> <input type="submit" name="teamall" value="All" class="submit_inline">
<input type="submit" name="team0" value="team1" class="submit_inline"> <input type="submit" name="team0" value="<?=$TEAM1?>" class="submit_inline">
<input type="submit" name="team1" value="team2" class="submit_inline"> <input type="submit" name="team1" value="<?=$TEAM1?>" class="submit_inline">
</form> </form>
<br><br> <br><br>
<table class="acces"> <table class="acces">
@ -109,10 +111,10 @@ if(isset($_POST['send'])) {
<td><?php <td><?php
switch ($stat['team']) { switch ($stat['team']) {
case "0": case "0":
echo "team1"; echo $TEAM1;
break; break;
case "1": case "1":
echo "team2"; echo $TEAM2;
break; break;
} }
?></td> ?></td>

View file

@ -0,0 +1,6 @@
<?php
$TEAM1 = "teamtest1";
$TEAM2 = "teamtest2";
?>

View file

@ -2,6 +2,7 @@
ob_start(); // Start reading html ob_start(); // Start reading html
include "script/db.php"; include "script/db.php";
include "assets/scripts/globals.php"
if(isset($_POST['send'])) { if(isset($_POST['send'])) {
if(!empty($_POST['answer']) AND !empty($_POST['team'])) { if(!empty($_POST['answer']) AND !empty($_POST['team'])) {
@ -14,9 +15,9 @@ if(isset($_POST['send'])) {
if($reponse[0]['team'] == NULL) { if($reponse[0]['team'] == NULL) {
//le "if" ici c'est parce que le 0 => $team = NULL du coup on doit genre faire une conversion relou //le "if" ici c'est parce que le 0 => $team = NULL du coup on doit genre faire une conversion relou
if($team == "team1") { if($team == $TEAM1) {
$team = 0; $team = 0;
} elseif($team == "team2") { } elseif($team == $TEAM2) {
$team = 1; $team = 1;
} else { } else {
header('Refresh: 0'); header('Refresh: 0');
@ -54,17 +55,19 @@ if(isset($_POST['send'])) {
<input type="text" placeholder="Réponse à l'énigme" name="answer" class="input"> <input type="text" placeholder="Réponse à l'énigme" name="answer" class="input">
<select name="team" class="input"> <select name="team" class="input">
<option value="">Choisissez votre équipe</option> <option value="">Choisissez votre équipe</option>
<option value="team1">team1</option> <?php
<option value="team2">team2</option> echo"<option value=".$TEAM1.">".$TEAM1."</option>"
echo"<option value=".$TEAM2.">".$TEAM2."</option>"
?>
</select> </select>
<input type="submit" name="send" value="Valider votre réponse" class="submit"> <input type="submit" name="send" value="Valider votre réponse" class="submit">
</form> </form>
<?php <?php
} else { } else {
if($reponse[0]['team'] == 0) { if($reponse[0]['team'] == 0) {
echo "La réponse de l'énigme de la plaquette à déja été trouvé par team1 !"; echo "La réponse de l'énigme de la plaquette à déja été trouvé par ".$TEAM1." !";
} else { } else {
echo "La réponse de l'énigme de la plaquette à déja été trouvé team2 !"; echo "La réponse de l'énigme de la plaquette à déja été trouvé ".$TEAM2." !";
} }
} }

View file

@ -2,6 +2,7 @@
ob_start(); // Start reading html ob_start(); // Start reading html
include "assets/fonts/color.php"; include "assets/fonts/color.php";
include "assets/scripts/globals.php"
?> ?>
<main> <main>
@ -30,8 +31,10 @@ include "assets/fonts/color.php";
Si tu as reçu (et lu!) ta <?= colored_text("plaquette") ?>, tu sais que tu fais partie d'une #team: Si tu as reçu (et lu!) ta <?= colored_text("plaquette") ?>, tu sais que tu fais partie d'une #team:
</p> </p>
<p> <p>
<a href="team.php?team=team2" class="link">team2</a>, <?php
ou <a href="team.php?team=team1" class="link">team1</a>. echo"<a href=\"team.php?team=".$TEAM2."\" class=\"link\">".$TEAM2."</a>,"
echo"<a href=\"team.php?team=".$TEAM1."\" class=\"link\">".$TEAM1."</a>"
?>
</p> </p>
<p> <p>
Fais gagner des points à ton équipe durant la semaine pour lui faire remporter les INSA BROS ! Fais gagner des points à ton équipe durant la semaine pour lui faire remporter les INSA BROS !

View file

@ -1,5 +1,7 @@
<?php <?php
ob_start(); // Start reading html ob_start(); // Start reading html
include "assets/scripts/globals.php"
?> ?>
<main> <main>
@ -13,7 +15,7 @@ ob_start(); // Start reading html
Pour avoir les news, rejoins le groupe <a href="https://www.facebook.com/groups/3305135659705279/" class="link">Facebook</a> de la Pour avoir les news, rejoins le groupe <a href="https://www.facebook.com/groups/3305135659705279/" class="link">Facebook</a> de la
semaine. On y postera des infos sur les événements à venir.<br> semaine. On y postera des infos sur les événements à venir.<br>
Et sinon tu peux rejoindre le <font color="red">groupe facebook de ton équipe</font> :<br> Et sinon tu peux rejoindre le <font color="red">groupe facebook de ton équipe</font> :<br>
<a href="https://www.facebook.com/groups/554998889637787" class="link">team2</a> ou <a href="https://www.facebook.com/groups/1440974243018687" class="link">team1</a> <a href="https://www.facebook.com/groups/554998889637787" class="link"><?php $TEAM2?></a> ou <a href="https://www.facebook.com/groups/1440974243018687" class="link"><?php $TEAM1?></a>
</p> </p>
<p> <p>
Tu peux également rejoindre l'Instagram : <a href="https://www.instagram.com/insat_accueil_2022/" class="link">@insat_accueil_2022</a> Tu peux également rejoindre l'Instagram : <a href="https://www.instagram.com/insat_accueil_2022/" class="link">@insat_accueil_2022</a>

View file

@ -8,6 +8,8 @@ if(isset($_GET['planning']) AND !empty(['planning']))
$planning = (int) htmlspecialchars($_GET['planning']); $planning = (int) htmlspecialchars($_GET['planning']);
} }
include "assets/scripts/globals.php"
?> ?>
<main> <main>
@ -247,8 +249,8 @@ if(isset($_GET['planning']) AND !empty(['planning']))
<section> <section>
<form method="POST"> <form method="POST">
<input type="submit" name="p2" value="Planning team1" class="submit"> <input type="submit" name="p2" value="Planning <?=$TEAM1?>" class="submit">
<input type="submit" name="p3" value="Planning team2" class="submit"> <input type="submit" name="p3" value="Planning <?=$TEAM1?>" class="submit">
<input type="submit" name="p1" value="Planning général" class="submit"> <input type="submit" name="p1" value="Planning général" class="submit">
</form> </form>
</section> </section>
@ -267,10 +269,10 @@ if(isset($planning)) {
$team_name = "général"; $team_name = "général";
break; break;
case 2: case 2:
$team_name = "team1"; $team_name = $TEAM1;
break; break;
case 3: case 3:
$team_name = "team2"; $team_name = $TEAM2;
break; break;
} }

View file

@ -15,6 +15,9 @@ $r1 = $req_p1->fetchAll(PDO::FETCH_ASSOC);
if(!($r1[0]['s'] > 0)) { if(!($r1[0]['s'] > 0)) {
$r1[0]['s'] = 0; $r1[0]['s'] = 0;
} }
include "assets/scripts/globals.php"
?> ?>
<main> <main>
<section> <section>
@ -28,8 +31,8 @@ if(!($r1[0]['s'] > 0)) {
<table class="out"> <table class="out">
<tr> <tr>
<td><div class="title_in">team1 - <?= $r0[0]['s'] ?> points</div></td> <td><div class="title_in"><?=$TEAM1?> - <?= $r0[0]['s'] ?> points</div></td>
<td><div class="title_in">team2 - <?= $r1[0]['s'] ?> points</div></td> <td><div class="title_in"><?=$TEAM2?>- <?= $r1[0]['s'] ?> points</div></td>
</tr> </tr>
<tr> <tr>
<td> <td>

View file

@ -2,6 +2,8 @@
if(!isset($relativepath)) { if(!isset($relativepath)) {
header('Location: ../index.php'); header('Location: ../index.php');
} }
include "assets/scripts/globals.php"
?> ?>
<!-- The actual menu * desktop --> <!-- The actual menu * desktop -->
@ -63,8 +65,8 @@ if(!isset($relativepath)) {
<!-- Top layer (LtR) --> <!-- Top layer (LtR) -->
<?php <?php
$co_y_0 = [0, 48.85, 97.7, 146.55, 195.4, 244.25, 293.1, 341.95, 390.8, 439.65, 488.5]; $co_y_0 = [0, 48.85, 97.7, 146.55, 195.4, 244.25, 293.1, 341.95, 390.8, 439.65, 488.5];
$texte_y_0 = ["Accueil", "Planning", "Plan", "Lydia/Izly", "Blouse", "team1", "team2", "Les stats", "INSARIO", "Prévention", ""]; $texte_y_0 = ["Accueil", "Planning", "Plan", "Lydia/Izly", "Blouse", $TEAM1, $TEAM2, "Les stats", "INSARIO", "Prévention", ""];
$lien_y_0 = ["index.php", "planning.php", "map.php", "lydia.php", "blouse.php", "team.php?team=team1", "team.php?team=team2", "stats.php", "game.php", "prevs.php", ""]; $lien_y_0 = ["index.php", "planning.php", "map.php", "lydia.php", "blouse.php", "team.php?team=".$TEAM1, "team.php?team=".$TEAM2, "stats.php", "game.php", "prevs.php", ""];
for($i = 0; $i <= 10; $i++) { for($i = 0; $i <= 10; $i++) {
echo echo
'<a href="'.$lien_y_0[$i].'" class="menu-link"> '<a href="'.$lien_y_0[$i].'" class="menu-link">

View file

@ -9,11 +9,13 @@ if(isset($_GET['team']))
} else { } else {
header('Location: errors/404.php'); header('Location: errors/404.php');
} }
include "assets/scripts/globals.php"
?> ?>
<main> <main>
<?php <?php
if($team === "team2") { if($team === $TEAM2) {
?> ?>
<style> <style>
@ -29,7 +31,7 @@ if($team === "team2") {
</section> </section>
<?php <?php
} elseif($team === "team1") { } elseif($team === $TEAM1) {
?> ?>
<style> <style>
@ -66,6 +68,6 @@ if($team === "team2") {
</main> </main>
<?php <?php
$infopage = ["", "team", ob_get_clean(), "", "team","team1"]; //relativepath, pagetitle, pagecontent, pagescript, pagename | cf structure/template.php ligne 2 à 6 $infopage = ["", "team", ob_get_clean(), "", "team",$team]; //relativepath, pagetitle, pagecontent, pagescript, pagename | cf structure/template.php ligne 2 à 6
include("structure/template.php"); include("structure/template.php");
?> ?>

View file

@ -3,6 +3,8 @@ ob_start(); // Start reading html
include "script/db.php"; include "script/db.php";
include "assets/scripts/globals.php"
$end = false; $end = false;
if(isset($_POST['send'])) { if(isset($_POST['send'])) {
@ -37,9 +39,9 @@ if(isset($_POST['send'])) {
if(isset($_POST['team']) AND !empty($_POST['team'])) { if(isset($_POST['team']) AND !empty($_POST['team'])) {
$team = htmlspecialchars($_POST['team']); $team = htmlspecialchars($_POST['team']);
if($team == "team1") { if($team == $TEAM1) {
$team = 0; $team = 0;
} elseif($team == "team2") { } elseif($team == $TEAM2) {
$team = 1; $team = 1;
} else { } else {
header('Refresh: 0'); header('Refresh: 0');
@ -85,8 +87,8 @@ if(isset($_POST['send'])) {
Franchement GG à vous, choisissez votre équipe ci-dessous pour lui faire remporter les points :<br> Franchement GG à vous, choisissez votre équipe ci-dessous pour lui faire remporter les points :<br>
<select name="team" class="input"> <select name="team" class="input">
<option value="">Choisissez votre équipe</option> <option value="">Choisissez votre équipe</option>
<option value="team1">Team1</option> <option value="<?=$TEAM1?>"><?=$TEAM1?></option>
<option value="team2">Team2</option> <option value="<?=$TEAM2?>"><?=$TEAM2?></option>
</select> </select>
<?php <?php
} }
@ -106,9 +108,9 @@ if(isset($_POST['send'])) {
echo "Aucune des deux équipes n'a réussi à trouver tous les mots"; echo "Aucune des deux équipes n'a réussi à trouver tous les mots";
} else { } else {
if($team_gg[0]['team'] == 0) { if($team_gg[0]['team'] == 0) {
echo "Team1 à déjà tout trouvé"; echo $TEAM1." à déjà tout trouvé";
} else { } else {
echo "Team2 à déjà tout trouvé"; echo $TEAM2." à déjà tout trouvé";
} }
} }
?> ?>