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.chauffagiste-essonne.com
/
htdocs
/
admin420
/
connected
/
functions
/
/srv/data/web/vhosts/www.chauffagiste-essonne.com/htdocs/admin420/connected/functions/products.php
<?php //Suppression d'une image if (isset($_POST['formRemove'])) { $idProduct = $_POST['id']; $stmt=$db_client->prepare("DELETE FROM product WHERE id=? AND id_company=?"); // on prépare notre requête $stmt->execute(array($idProduct,$conf_id_company)); //Si le produit n'existe pas retour if($stmt->rowCount()!=1) header("Location: catalogue"); //Supression image $stmt=$db_client->prepare("SELECT * FROM product_image WHERE product=?"); // on prépare notre requête $stmt->execute(array($idProduct)); $pictures = $stmt->fetchAll(); foreach ($pictures as $picture) { if(unlink("../../".$picture->src)){ $stmt=$db_client->prepare("DELETE FROM product_image WHERE id=?"); // on prépare notre requête $stmt->execute(array($picture->id)); } } echo "<div class='alert alert-success'> <button type='button' class='close' data-dismiss='alert'>×</button>Votre produit a bien été supprimé. </div>"; } //Récupère toutes les produits $stmt=$db_client->prepare("SELECT * FROM product WHERE id_company=? ORDER BY name"); // on prépare notre requête $stmt->execute(array($conf_id_company)); $products = $stmt->fetchAll();