query('SELECT * FROM planning_insa'); if(isset($_GET['del']) AND !empty($_GET['del'])) { if($user['perm'] >= 1) { $del = (int) htmlspecialchars($_GET['del']); $req = $db->prepare('DELETE FROM planning_insa WHERE id =?'); $req->execute(array($del)); header('Location: planning.php'); } } if(isset($_GET['select']) AND !empty($_GET['select'])) { $select = (int) htmlspecialchars($_GET['select']); $req = $db->prepare('SELECT * FROM planning_insa WHERE num_planning = ?'); $req->execute(array($select)); } $req2 = $db->query('SELECT num_planning FROM planning_insa'); $tab = []; $length = 0; while($h = $req2->fetch()) { array_push($tab, $h['num_planning']); $length++; } $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'])) { $day = (int) htmlspecialchars($_POST['day']); $title = htmlspecialchars($_POST['title']); $desc = htmlspecialchars($_POST['description']); $color = htmlspecialchars($_POST['color']); $opacity = (float) htmlspecialchars($_POST['opacity']); $order_start = (int) htmlspecialchars($_POST['order_start']); $len = (float) (100/20)*htmlspecialchars($_POST['length']); $num_planning = (int) htmlspecialchars($_POST['num_planning']); 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) { $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 %"; } } else { $error = "Tout les champs doivent être complétés"; } } } ?> Admin / Planning


".$error.""; } ?> '; } } ?>

fetch()) { ?>
ID (db) Jour Titre Description Couleur Ordre d'apparition taille Planning n° Action
% X