<?php
// simple_cleanup.php
$temp_dir = '../temp_qrcodes/';

if (file_exists($temp_dir)) {
    $files = glob($temp_dir . '*.png');
    $deleted = 0;
    
    foreach ($files as $file) {
        // Delete files older than 1 hour
        if (time() - filemtime($file) > 3600) {
            if (unlink($file)) {
                $deleted++;
            }
        }
    }
    
    echo "Deleted $deleted old QR code files.";
} else {
    echo "QR directory not found.";
}
?>