<?php
session_start(); // Start the session to access session variables

// Check if the token value is passed via POST request
if (isset($_POST['wonTokens'])) {
    $_SESSION['wonTokens'] = $_POST['wonTokens'];  // Store the won token value in the session
}

$tokens = isset($_SESSION['wonTokens']) ? $_SESSION['wonTokens'] : 0; // Retrieve token value from session
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">




    <title>Claim Your Tokens</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            padding: 20px;
            background-color: #f4f4f9;
            background: url('./img/pe.png') no-repeat center center fixed;
               -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* Internet Explorer */
    user-select: none; /* Standard */
        }
        h1 {
            color: #333;
        }
        .claim-button {
            padding: 15px 30px;
            font-size: 20px;
            cursor: pointer;
            background-color: #28a745;
            color: white;
            border: none;
            border-radius: 5px;
        }
        .claim-button:hover {
            background-color: #218838;
        }
    </style>
</head>
<body>

<h1>Claim Your Tokens</h1>

<?php if ($tokens > 0): ?>
    <button class="claim-button" onclick="window.location.href='./wallet/index.php'">
        Claim $<?php echo number_format($tokens, 2); ?> Tokens
    </button>
<?php else: ?>
    <p>You have not won any tokens yet.</p>
<?php endif; ?>

</body>
</html>
