<?php
require_once '../config.php';
session_start();

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

// TOTAL USERS
$res1 = $conn->query("SELECT COUNT(*) as total FROM fxh_users");
$total_users = $res1->fetch_assoc()['total'];

// TOTAL LICENSES
$res2 = $conn->query("SELECT COUNT(*) as total FROM fxh_licenses");
$total_licenses = $res2->fetch_assoc()['total'];

// ACTIVE LICENSES
$res3 = $conn->query("SELECT COUNT(*) as total FROM fxh_licenses WHERE status='active'");
$active_licenses = $res3->fetch_assoc()['total'];

?>
<!DOCTYPE html>
<html>
<head>
<title>FXH Admin</title>
</head>
<body>
<h2>FX-HUNTER Admin Panel</h2>

<p><b>Total Users:</b> <?= $total_users ?></p>
<p><b>Total Licenses:</b> <?= $total_licenses ?></p>
<p><b>Active Licenses:</b> <?= $active_licenses ?></p>

<a href="licenses.php">Manage Licenses</a> |
<a href="logout.php">Logout</a>

</body>
</html>
