<?php
session_start();
$dir = __DIR__ . '/uploads/glasses/';
if (isset($_GET['delete'])) {
    $file = basename($_GET['delete']);
    $path = $dir . $file;
    if (file_exists($path) && strtolower(pathinfo($path, PATHINFO_EXTENSION)) == 'png') {
        unlink($path);
        $_SESSION['success'] = 'Image deleted successfully.';
    } else {
        $_SESSION['error'] = 'Image not found.';
    }
    header('Location: admin.php');
    exit;
}
?>
