
<?php
$token = $_GET['token'] ?? '';
$page = $_GET['page'] ?? '';

$unlocksFile = __DIR__ . '/unlocks.json';

if ($token && in_array($page, ['4', '6'])) {
    $unlocks = file_exists($unlocksFile) ? json_decode(file_get_contents($unlocksFile), true) : [];
    $unlocks[$token] = $page;
    file_put_contents($unlocksFile, json_encode($unlocks, JSON_PRETTY_PRINT));
    echo "<h3 style='font-family:Arial; color:green;'>✅ Zugriff freigegeben für Token: <code>$token</code> → Seite: $page</h3>";
} else {
    echo "<h3 style='font-family:Arial; color:red;'>❌ Ungültiger Token oder Seite</h3>";
}
?>
