<?php
session_start();
include('../includes/config.php');

// Get counts for stats
$count_result = mysqli_query($conn, "SELECT status, COUNT(*) as count FROM users GROUP BY status");
$status_counts = array('verified' => 0, 'pending' => 0, 'rejected' => 0, 'total' => 0);
while ($row = mysqli_fetch_assoc($count_result)) {
    $status_counts[$row['status']] = $row['count'];
}
$status_counts['total'] = array_sum($status_counts);

echo json_encode(array(
    'success' => true,
    'total' => $status_counts['total'],
    'verified' => $status_counts['verified'],
    'pending' => $status_counts['pending'],
    'rejected' => $status_counts['rejected']
));
?>