<?php
require_once "config/db.php";

$slug = $_GET['slug'] ?? '';
if (!$slug) {
    die("Page not found.");
}

$stmt = $pdo->prepare("SELECT * FROM product_page WHERE slug = ?");
$stmt->execute([$slug]);
$page = $stmt->fetch();

if (!$page) {
    die("Page not found.");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= htmlspecialchars($page['main_title']) ?></title>
    <meta name="description" content="<?= htmlspecialchars($page['meta_description']) ?>">
    <meta name="keywords" content="<?= htmlspecialchars($page['meta_keywords']) ?>">
</head>
<body>
    <h1><?= htmlspecialchars($page['main_title']) ?></h1>
    <h4><?= htmlspecialchars($page['main_description']) ?></h4>
</body>
</html>