<?php
session_start();
include 'cfg.php';

$code = $_GET['code'] ?? '';
$stmt = $pdo->prepare("SELECT is_winner FROM vouchers WHERE code = ?");
$stmt->execute([$code]);
$voucher = $stmt->fetch();

header('Content-Type: application/json');
echo json_encode([
    'is_winner' => $voucher ? (int)$voucher['is_winner'] : 0
]);
?>