From 612b1120c4acbbd087d7be830736625898ea7369 Mon Sep 17 00:00:00 2001 From: Baptiste Date: Sat, 18 Jun 2022 13:21:04 +0200 Subject: [PATCH] transparent --- admin/planning.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/admin/planning.php b/admin/planning.php index 79b05bb..727305a 100644 --- a/admin/planning.php +++ b/admin/planning.php @@ -36,7 +36,7 @@ $tab = array_unique($tab); //supprimer les doublons if(isset($_POST['send'])) { if($user['perm'] >= 1) { - if(isset($_POST['day']) AND !empty($_POST['day']) AND isset($_POST['title']) AND !empty($_POST['title']) AND isset($_POST['description']) AND !empty($_POST['description']) AND isset($_POST['color']) AND !empty($_POST['color']) AND isset($_POST['order_start']) AND !empty($_POST['order_start']) AND isset($_POST['length']) AND !empty($_POST['length']) AND isset($_POST['num_planning']) AND !empty($_POST['num_planning']) AND isset($_POST['opacity']) AND !empty($_POST['opacity'])) { + if(isset($_POST['day']) AND !empty($_POST['day']) AND isset($_POST['title']) AND !empty($_POST['title']) AND isset($_POST['description']) AND !empty($_POST['description']) AND isset($_POST['color']) AND !empty($_POST['color']) AND isset($_POST['order_start']) AND !empty($_POST['order_start']) AND isset($_POST['length']) AND !empty($_POST['length']) AND isset($_POST['num_planning']) AND !empty($_POST['num_planning']) AND isset($_POST['opacity'])) { $day = (int) htmlspecialchars($_POST['day']); $title = htmlspecialchars($_POST['title']); $desc = htmlspecialchars($_POST['description']); @@ -50,16 +50,21 @@ if(isset($_POST['send'])) { if (isset($_POST['colorhex']) AND !empty($_POST['colorhex'])) { $color = htmlspecialchars($_POST['colorhex']); } else { - $color = $color.dechex($opacity*2.55); + + if($opacity <= 100 AND $opacity >= 0) { + if(opacity == 0) { + $color = "transparent"; + } else { + $color = $color.dechex($opacity*2.55); + } + } else { + $error = "l'opacité doit être en %"; + } } - if($opacity <= 100 AND $opacity >= 0) { - $req = $db->prepare("INSERT INTO planning_insa(day, title, description, color, order_start, length, num_planning) VALUES(?, ?, ?, ?, ?, ?, ?)"); - $req->execute(array($day, $title, $desc, $color, $order_start, $len, $num_planning)); - header('refresh:0'); - } else { - $error ="L'opacité doit être en %"; - } + $req = $db->prepare("INSERT INTO planning_insa(day, title, description, color, order_start, length, num_planning) VALUES(?, ?, ?, ?, ?, ?, ?)"); + $req->execute(array($day, $title, $desc, $color, $order_start, $len, $num_planning)); + header('refresh:0'); } else { $error = "Tout les champs doivent être complétés";