com photo dashboard
114
admin/com_photo.php
Normal file
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
include "script.php";
|
||||
|
||||
$refresh_rate = 15; //refresh rate en seconde (en gros on refresh la page toute les 15sec)
|
||||
|
||||
if($user['perm'] < 1) {
|
||||
header('Location: deco.php');
|
||||
}
|
||||
|
||||
|
||||
// Compress image
|
||||
function compressImage($source, $destination, $quality) {
|
||||
|
||||
$info = getimagesize($source);
|
||||
|
||||
if ($info['mime'] == 'image/jpeg')
|
||||
$image = imagecreatefromjpeg($source);
|
||||
|
||||
elseif ($info['mime'] == 'image/gif')
|
||||
$image = imagecreatefromgif($source);
|
||||
|
||||
elseif ($info['mime'] == 'image/png')
|
||||
$image = imagecreatefrompng($source);
|
||||
|
||||
imagejpeg($image, $destination, $quality);
|
||||
|
||||
}
|
||||
|
||||
// ajout d'une epreuve
|
||||
if(isset($_POST['add_photo'])){
|
||||
|
||||
//$upload_state prend plusieurs valeurs :
|
||||
// 1 si tout est valide et l'image n'existe pas déjà
|
||||
// 0 si une verification a invalidé le fichier
|
||||
|
||||
|
||||
$EXT_WHITELIST = array("gif","jpg","jpeg","png");
|
||||
|
||||
/* gestion des uploads d'images indices */
|
||||
$target_dir = "../assets/img/com_photo/full_q/";
|
||||
$target_file = $target_dir . basename($_FILES["photo"]["name"]);
|
||||
$upload_state = 1;
|
||||
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
|
||||
// Check if image file is a actual image or fake image
|
||||
$check = $_FILES["photo"]["size"] > pow(2,6);;
|
||||
if($check !== false) {
|
||||
$upload_state = 1;
|
||||
} else {
|
||||
$upload_state = 0;
|
||||
}
|
||||
|
||||
if (file_exists($target_file)) {
|
||||
$upload_state = 0;
|
||||
}
|
||||
|
||||
// limite de taille
|
||||
if ($_FILES["photo"]["size"] > pow(2,40)) {
|
||||
$upload_state = 0;
|
||||
}
|
||||
|
||||
// check le type de fichier
|
||||
if (!in_array($imageFileType,$EXT_WHITELIST)){
|
||||
$upload_state = 0;
|
||||
}
|
||||
|
||||
switch($upload_state){
|
||||
case 1:
|
||||
compressImage($_FILES["photo"]["tmp_name"],"../assets/img/com_photo/thumbs/".$_FILES["photo"]["name"],10);
|
||||
move_uploaded_file($_FILES["photo"]["tmp_name"],$target_file);
|
||||
break;
|
||||
case 0:
|
||||
?> <script>
|
||||
alert("L'image envoyée n'a pas passées tout les tests de vérifications.");
|
||||
</script>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin / Com'Photo</title>
|
||||
<link rel="stylesheet" type="text/css" href="com_ville.css" />
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<input type="file" name="photo" placeholder="image.png" id="photo" class="input_inline" accept=".png,.jpg,.jpeg,.gif">
|
||||
<label for="photo">Seulement les images au format gif, png, jpeg et jpg sont acceptées.</label>
|
||||
<input type="submit" name="add_photo" value="Ajouter la photo" class="submit_inline">
|
||||
</form>
|
||||
|
||||
<h3>Difficultés pour convertir vos images au bon format ? Essayez <a href="https://image.online-convert.com/convert-to-jpg">Ce site</a></h3>
|
||||
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
|
@ -88,7 +88,7 @@ if(isset($_GET['adm']) AND !empty($_GET['adm']))
|
|||
if(isset($_POST['send'])) {
|
||||
if(isset($_POST['pseudo']) AND !empty($_POST['pseudo']) AND isset($_POST['perm']) AND !empty($_POST['perm'])) {
|
||||
|
||||
if($user['perm'] >= 3) {
|
||||
if($user['perm'] >= 4) {
|
||||
$pseudo = htmlspecialchars($_POST['pseudo']);
|
||||
$perm = htmlspecialchars($_POST['perm']);
|
||||
|
||||
|
@ -140,7 +140,7 @@ if(isset($_POST['send'])) {
|
|||
<input type="text" placeholder="identifiant INSA" name="pseudo" class="input_inline">
|
||||
<select name="perm" class="input_inline">
|
||||
<option value="v0">GDA - Perm 0</option>
|
||||
<option value="v1">Ville - Perm 1</option>
|
||||
<option value="v1">Ville/Photo - Perm 1</option>
|
||||
<option value="v2">Bureau - Perm 2</option>
|
||||
<option value="v3">Admin - Perm 3</option>
|
||||
</select>
|
||||
|
|
|
@ -1,175 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
|
||||
<style>
|
||||
.cmv-progress {
|
||||
color: white;
|
||||
min-height: 200px;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
h5.cmv-title {
|
||||
font-size: 1.1em;
|
||||
padding: 1em 1em 0;
|
||||
}
|
||||
|
||||
.cmv-container {
|
||||
display:flex;
|
||||
position:relative;
|
||||
width:90%;
|
||||
margin:auto;
|
||||
height:100px;
|
||||
}
|
||||
|
||||
.cmv-step {
|
||||
position: relative;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background-color: #ccc;
|
||||
color: black;
|
||||
z-index: 5;
|
||||
border-radius: 50%;
|
||||
line-height: 36px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cmv-step.fait, .cmv-step.active {
|
||||
background-color: #06a6b7;
|
||||
}
|
||||
|
||||
.cmv-step.active:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
display: block;
|
||||
background-color: white;
|
||||
margin: 15%;
|
||||
width: 70%;
|
||||
height: 70%;
|
||||
border-radius: 50%;
|
||||
z-index: -15;
|
||||
}
|
||||
|
||||
.cmv-way {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.cmv-way.fait:before {
|
||||
background-color: #06a6b7;
|
||||
}
|
||||
|
||||
.cmv-way:before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 120%; height: 1px;
|
||||
margin-left: -10%;
|
||||
margin-top: 17px;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.cmv-fixed:before {
|
||||
content: "";
|
||||
width:1px; height: 7px;
|
||||
background-color: white;
|
||||
position: absolute;
|
||||
top:42px;
|
||||
left: 18px;
|
||||
}
|
||||
|
||||
.cmv-fixed {
|
||||
color: white;
|
||||
width: 100%;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.cmv-relative {
|
||||
content: "52m";
|
||||
position: absolute;
|
||||
color: white;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
top: -10px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="cmv-progress">
|
||||
|
||||
<h5 id="cmv-title" class="cmv-title">Equipe 1-1</h5>
|
||||
|
||||
<div class="cmv-container">
|
||||
|
||||
<?php
|
||||
|
||||
/** Pour une équipe donnée */
|
||||
|
||||
/** $depart : Le point de départ de cette équipe */
|
||||
$depart = 4;
|
||||
|
||||
/** $etape : À quelle étape en est cette équipe */
|
||||
$etape = 5;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** $i va de 1 à 17 (inclus), 17 étant le nombre d'étapes */
|
||||
for ($i = 1; $i <= 17; $i++) {
|
||||
|
||||
/** $node : Le numéro dans la node à l'emplacement $i
|
||||
* exemple : si une équipe commence au point 7 alors la première node ($i = 1)
|
||||
* va contenir $node = 7 À UTILISER POUR LES TEMPS ! */
|
||||
$node = ($i + $depart - 2) % 17 + 1;
|
||||
|
||||
/** $current : À quel index est placé la node correspondante à l'$etape
|
||||
* exemple : une équipe qui commence au point 17 en est au point 3,
|
||||
* elle est donc affichée comme étant au niveau de la node d'index 4 ($i = 4)
|
||||
* puisque de gauche à droite les premières nodes sont 17 - 1 - 2 - 3 */
|
||||
$current = $etape - $depart + 1;
|
||||
if ($current < 0) {
|
||||
$current = $current + 17;
|
||||
}
|
||||
|
||||
/** Si le point $i a été fait (fait), est en train d'être fait (actuel), ou n'a pas encore été atteint */
|
||||
$state = '';
|
||||
if ($i < $current) {
|
||||
$state = ' fait';
|
||||
} elseif ($i === $current) {
|
||||
$state = ' active';
|
||||
}
|
||||
|
||||
|
||||
echo '<div class="cmv-step'.$state.'">';
|
||||
echo $node;
|
||||
|
||||
if ($i <= $current) {
|
||||
// --:-- doit être remplacé par l'heure à laquelle le point $node a été atteint
|
||||
echo '<div class="cmv-fixed">--:--</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
if ($i < 17) {
|
||||
echo '<div class="cmv-way'.$state.'">';
|
||||
if ($i < $current) {
|
||||
echo '<div class="cmv-relative">--m</div>'; // --mn doit être remplacé par le deltaT entre les points $node et $node+1
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -24,17 +24,21 @@ if($user_exist != 1) {
|
|||
|
||||
switch ($user['perm']) {
|
||||
case 1:
|
||||
$content = $content."<a href='ville.php'><li class='yellow'>Com'ville</li></a>";
|
||||
$content = $content."<a href='ville.php'><li class='yellow'>Com'ville</li></a>"
|
||||
."<a href='com_photo.php'><li class='yellow'>Com'Photo</li></a>";
|
||||
|
||||
break;
|
||||
case 2:
|
||||
$content = $content
|
||||
."<a href='ville.php'><li class='yellow'>Com'ville</li></a>"
|
||||
.'<a href="planning.php"><li class="orange">Planning</li></a>';
|
||||
.'<a href="planning.php"><li class="orange">Planning</li></a>'
|
||||
."<a href='com_photo.php'><li class='yellow'>Com'Photo</li></a>";
|
||||
break;
|
||||
case 3:
|
||||
$content = $content
|
||||
."<a href='ville.php'><li class='yellow'>Com'ville</li></a>"
|
||||
."<a href=\"planning.php\"><li class=\"orange\">Planning</li></a>"
|
||||
."<a href='com_photo.php'><li class='yellow'>Com'Photo</li></a>"
|
||||
."<a href=\"mots_croises.php\"><li class=\"orange\">Mots croises</li></a>"
|
||||
."<a href=\"gestion_des_acces.php\"><li class=\"red\">Gestion des accès</li></a>"
|
||||
."<a href=\"enigma.php\"><li class=\"red\">Enigma</li></a>"
|
||||
|
|
|
@ -13,18 +13,76 @@ if($user['perm'] < 1) {
|
|||
// ajout d'une epreuve
|
||||
if(isset($_POST['add_epreuve'])){
|
||||
|
||||
//$upload_state prend plusieurs valeurs :
|
||||
// 1 si tout est valide et l'image n'existe pas déjà
|
||||
// 0 si une verification a invalidé le fichier
|
||||
// 2 si l'image existe déjà mais l'upload est valide, on va alors utiliser le nom pour la bdd
|
||||
|
||||
|
||||
$EXT_WHITELIST = array("gif","jpg","jpeg","raw","png","svg");
|
||||
|
||||
/* gestion des uploads d'images indices */
|
||||
$target_dir = "../assets/img/com_ville/";
|
||||
$target_file = $target_dir . basename($_FILES["photo"]["name"]);
|
||||
$upload_state = 1;
|
||||
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
|
||||
// Check if image file is a actual image or fake image
|
||||
$check = $_FILES["photo"]["size"] > pow(2,2);;
|
||||
if($check !== false) {
|
||||
$upload_state = 1;
|
||||
} else {
|
||||
$upload_state = 0;
|
||||
}
|
||||
|
||||
if (file_exists($target_file)) {
|
||||
$upload_state = 2;
|
||||
}
|
||||
|
||||
// limite de taille
|
||||
if ($_FILES["photo"]["size"] > pow(2,25)) {
|
||||
$upload_state = 0;
|
||||
}
|
||||
|
||||
// check le type de fichier
|
||||
if (!in_array($imageFileType,$EXT_WHITELIST)){
|
||||
$upload_state = 0;
|
||||
}
|
||||
|
||||
$file_name = "";
|
||||
switch($upload_state){
|
||||
case 1:
|
||||
|
||||
move_uploaded_file($_FILES["photo"]["tmp_name"],$target_file);
|
||||
$file_name = htmlspecialchars($_FILES["photo"]["name"]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$file_name = htmlspecialchars($_FILES["photo"]["name"]);
|
||||
break;
|
||||
case 0:
|
||||
?> <script>
|
||||
alert("L'image envoyée n'a pas passées tout les tests de vérifications.");
|
||||
</script>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
|
||||
$_POST['est_finale'] = $_POST['est_finale'] == 'on' ? true : false;
|
||||
|
||||
$req = $db->prepare("INSERT INTO ville_epreuve(indice,reponse,photo,id_equipe,est_finale,ordre,est_trouvee) VALUES(?,?,?,?,?,?,?)");
|
||||
$req->execute(array(htmlspecialchars($_POST['indice']),
|
||||
htmlspecialchars($_POST['reponse']),
|
||||
htmlspecialchars($_POST['photo']),
|
||||
$file_name,
|
||||
(int)htmlspecialchars($_POST['id_equipe']),
|
||||
(bool)htmlspecialchars($_POST['est_finale']),
|
||||
(int)htmlspecialchars($_POST['ordre']),
|
||||
false
|
||||
|
||||
));
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//ajout d'une equipe
|
||||
|
@ -47,6 +105,11 @@ if(isset($_POST['del_epreuve'])){
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
@ -59,12 +122,13 @@ if(isset($_POST['del_epreuve'])){
|
|||
<body>
|
||||
<main>
|
||||
|
||||
<form method="POST">
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<input type="text" name="indice" placeholder="indice" class="input_inline">
|
||||
<input type="text" name="reponse" placeholder="réponse" class="input_inline">
|
||||
<input type="text" name="photo" placeholder="image.png" class="input_inline">
|
||||
<input type="file" name="photo" placeholder="image.png" id="photo" class="input_inline">
|
||||
<input type="number" name="id_equipe" id="id_equipe" class="input_inline" value="<?= isset($_GET["ekip"]) ? (int)$_GET["ekip"]:1;?>">
|
||||
<label for="id_equipe">id de l'équipe</label>
|
||||
<br>
|
||||
<input type="radio" name="est_finale" id="est_finale" class="input_inline">
|
||||
<label for="est_finale">ultime épreuve</label>
|
||||
<input type="number" name="ordre" id="ordre" class="input_inline">
|
||||
|
|
Before Width: | Height: | Size: 259 KiB |
101597
assets/img/com_ville/crossword-PM96zyt93g.svg
Normal file
After Width: | Height: | Size: 2.9 MiB |
Before Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 107 KiB |
Before Width: | Height: | Size: 133 KiB |
Before Width: | Height: | Size: 124 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 108 KiB |
Before Width: | Height: | Size: 84 KiB |
|
@ -112,7 +112,7 @@ include "assets/scripts/globals.php";
|
|||
ou encore des directives concernant ta magnifique <a href="blouse.php" class="link">Blouse</a>.
|
||||
</p>
|
||||
<br>
|
||||
<h3><a href="enigma.php" style="text-decoration: none; color: black;">ENVAH'INSA</a></h3>
|
||||
<h3><a href="enigma.php" style="text-decoration: none; color: black;">INSA'RMORIQUE</a></h3>
|
||||
<p>
|
||||
Si tu as reçu (et lu!) ta <?= colored_text("plaquette") ?>, tu sais que tu fais partie d'une #team:
|
||||
</p>
|
||||
|
@ -123,7 +123,7 @@ include "assets/scripts/globals.php";
|
|||
?>
|
||||
</p>
|
||||
<p>
|
||||
Fais gagner des points à ton équipe durant la semaine pour lui faire remporter l' ENVAH'INSA !
|
||||
Fais gagner des points à ton équipe durant la semaine pour lui faire remporter l' INSA'RMORIQUE !
|
||||
</p>
|
||||
<p>
|
||||
Si tu souhaites voir le détail des scores, <a href="stats.php" class="link">c'est par ici</a>.
|
||||
|
|