-
Notifications
You must be signed in to change notification settings - Fork 0
/
article_delete.php
43 lines (39 loc) · 1.06 KB
/
article_delete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
require_once '../images/config_projet.php';
require_once '../session.php';
require_once '../templates/pdo.php';
require_once '../tools.php';
require_once '../images/articles.php';
require_once "header_admin.php";
$article = false;
$errors = [];
$messages = [];
if (isset($_GET["id"])) {
$article = getArticleById($pdo, $_GET["id"]);
}
if ($article) {
if (deleteArticle($pdo, $_GET["id"])) {
$messages[] = "L'article a bien été supprimé";
} else {
$errors[] = "Une erreur s'est produite lors de la suppression";
}
} else {
$errors[] = "L'article n'existe pas";
}
?>
<div class="row text-center my-5">
<h1>Supression article</h1>
<?php foreach ($messages as $message) { ?>
<div class="alert alert-success" role="alert">
<?= $message; ?>
</div>
<?php } ?>
<?php foreach ($errors as $error) { ?>
<div class="alert alert-danger" role="alert">
<?= $error; ?>
</div>
<?php } ?>
</div>
<?php
require_once "footer_admin.php";
?>