Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
www.shinegis.mu
/
htdocs
/
admin910
/
connected
/
/srv/data/web/vhosts/www.shinegis.mu/htdocs/admin910/connected/actualites.php
<?php require_once("../../config/database.php"); function getActualites($database) { $stmt = $database->prepare("SELECT * FROM actualites ORDER BY updated_at DESC"); $stmt->execute(); $row = $stmt->fetchAll(); return $row; } $actualites = getActualites($db_client); if (isset($_POST['deleteActualite'])) { $id = $_POST['actualite_id']; $request = $db_client->prepare("SELECT image FROM actualites WHERE id=?"); $request->execute([$id]); $imagePath = $request->fetch(); if (isset($imagePath)) { unlink("../.." . $imagePath->image); } $stmt = $db_client->prepare("DELETE FROM actualites WHERE id = ?"); $stmt->execute([$id]); header("Refresh:0"); } ?> <div class="actualites"> <a href="create" class="btn btn-primary mt-3">Créer un nouvel article</a> <table class="table"> <thead> <tr> <th scope="col">#</th> <th scope="col">Titre</th> <th scope="col">Image</th> <th scope="col">Updated_at</th> <th scope="col">Created_at</th> <th scope="col">Modifier</th> <th scope="col">Supprimer</th> </tr> </thead> <tbody> <?php foreach ($actualites as $actualite) : ?> <tr> <th scope="row"><?= $actualite->id ?></th> <td><?= $actualite->title ?></td> <td> <?php if (isset($actualite->image)) : ?> <img src="<?= $actualite->image ?>" alt="" style="width: 30%; max-height: 150px; object-fit: cover;" loading="lazy" /> <?php else : ?> <p>pas d'image</p> <?php endif ?> </td> <td><?= $actualite->updated_at ?></td> <td><?= $actualite->created_at ?></td> <td> <a href="edit?id=<?= $actualite->id ?>" class="btn btn-warning mt-1">Modifier</a> </td> <td> <form action="" method="post"> <input type="hidden" name="actualite_id" value="<?= $actualite->id ?>" /> <button id="deleteActualite" name="deleteActualite" for="deleteActualite" class="btn btn-danger">Supprimer</button> </form> </td> </tr> <?php endforeach ?> </tbody> </table> </div>