transparent

This commit is contained in:
Baptiste 2022-06-18 13:21:04 +02:00
parent 8e526d73ce
commit 612b1120c4

View file

@ -36,7 +36,7 @@ $tab = array_unique($tab); //supprimer les doublons
if(isset($_POST['send'])) { if(isset($_POST['send'])) {
if($user['perm'] >= 1) { 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']); $day = (int) htmlspecialchars($_POST['day']);
$title = htmlspecialchars($_POST['title']); $title = htmlspecialchars($_POST['title']);
$desc = htmlspecialchars($_POST['description']); $desc = htmlspecialchars($_POST['description']);
@ -50,16 +50,21 @@ if(isset($_POST['send'])) {
if (isset($_POST['colorhex']) AND !empty($_POST['colorhex'])) { if (isset($_POST['colorhex']) AND !empty($_POST['colorhex'])) {
$color = htmlspecialchars($_POST['colorhex']); $color = htmlspecialchars($_POST['colorhex']);
} else { } 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 = $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));
$req->execute(array($day, $title, $desc, $color, $order_start, $len, $num_planning)); header('refresh:0');
header('refresh:0');
} else {
$error ="L'opacité doit être en %";
}
} else { } else {
$error = "Tout les champs doivent être complétés"; $error = "Tout les champs doivent être complétés";