This commit is contained in:
Baptiste 2022-06-17 15:08:08 +02:00
parent e99847d088
commit eaaf37f193

View file

@ -36,18 +36,24 @@ $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'])) {
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) htmlspecialchars($_POST['length']);
$num_planning = (int) htmlspecialchars($_POST['num_planning']);
$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');
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.dechex($opacity), $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";
}
@ -76,6 +82,7 @@ if(isset($_POST['send'])) {
<input type="text" class="input_inline" name="title" placeholder="titre">
<input type="text" class="input_inline" name="description" placeholder="description">
<input type="color" name="color">
<input type="float" class="input_inline" name="opacity" placeholder="Opacité (%)" value="100">
<input type="number" class="input_inline" name="order_start" placeholder="Ordre d'apparition">
<input type="float" class="input_inline" name="length" placeholder="Taille (%)">
<select name="num_planning" class="input_inline">
@ -146,7 +153,7 @@ if(isset($_POST['send'])) {
?></td>
<td><?= $r['title'] ?></td>
<td><?= $r['description'] ?></td>
<td bgcolor="<?= $r['color'] ?>"></td>
<td style="background-color: <?= $r['color'] ?>;"></td>
<td><?= $r['order_start'] ?></td>
<td><?= $r['length'] ?>%</td>
<td><?= $r['num_planning'] ?></td>