<?php
// Fix default template path if user manually added the file
require_once __DIR__ . '/config/db.php';
$target = 'uploads/templates/templates.jpg';

if (file_exists(__DIR__ . '/' . $target)) {
    $stmt = $pdo->prepare("UPDATE settings SET template_path = ? WHERE id = 1");
    $stmt->execute([$target]);
    echo "<h1>Updated!</h1> <p>System is now using: $target</p>";
} else {
    echo "<h1>Warning</h1> <p>File <code>$target</code> was not found. Please upload it via Admin Settings or place it manually.</p>";
}
echo "<br><a href='index.php'>Go Home</a>";
?>
