<?php
session_start();
if (!isset($_SESSION['is_admin']) || $_SESSION['is_admin'] !== true) die('Access Denied');

try {
    $db = new PDO('sqlite:' . __DIR__ . '/app_feed.db');
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $sql = "INSERT OR REPLACE INTO app_feed_settings (setting_key, setting_value) VALUES 
            ('bg_dash_ng', '/assets/bg/dash_ng.png'),
            ('bg_index_ng', '/assets/bg/index_ng.png')";
    
    $db->exec($sql);
    
    echo "<h1>Registration Successful!</h1>";
    echo "<p>Your backgrounds have been linked to the database.</p>";
    echo "<a href='admin.php'>Click here to return to your Admin Panel</a>";
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}
?>