<?php
session_start();
require __DIR__ . "/config/db.php";

if (!isset($_SESSION['user_id'])) {
    header("Location: login.php");
    exit;
}

// Check premium
$stmt = $conn->prepare("SELECT is_active FROM users WHERE id=?");
$stmt->bind_param("i", $_SESSION['user_id']);
$stmt->execute();
$user = $stmt->get_result()->fetch_assoc();

if (!$user || $user['is_active'] != 1) {
    header("Location: upgrade.php");
    exit;
}
?>

<!DOCTYPE html>
<html>
<head>
<title>Training</title>
</head>

<body style="font-family:Arial; padding:40px;">

<h2>🎓 Training</h2>
<p>Training content will be available here.</p>

</body>
</html>