| Current Path : /home/seto/888mirror.pm/admin/ |
| Current File : /home/seto/888mirror.pm/admin/brand_delete.php |
<?php
require_once __DIR__ . '/../includes/auth.php';
require_once __DIR__ . '/../includes/helpers.php';
auth_check();
$id = (int)($_GET['id'] ?? 0);
if ($id) {
$brand = db()->prepare("SELECT logo FROM brands WHERE id = ?");
$brand->execute([$id]);
$row = $brand->fetch();
// Удалить файл логотипа если есть
if ($row && $row['logo']) {
$file = __DIR__ . '/../' . ltrim($row['logo'], '/');
if (file_exists($file)) {
@unlink($file);
}
}
db()->prepare("DELETE FROM brands WHERE id = ?")->execute([$id]);
}
header('Location: /admin/brands.php?msg=' . urlencode('Бренд удалён'));
exit();