<?php
/**
 * Grovia Admin Portal Entry Point
 * Redirects users based on authentication status.
 */

session_start();

// 1. Check if the staff member is already authenticated
if (isset($_SESSION['team_id']) && !empty($_SESSION['team_id'])) {
    
    // User is logged in, send them to the main analytics hub
    header("Location: dashboard.php");
    exit();

} else {
    
    // No active session found, redirect to the secure login portal
    header("Location: login.php");
    exit();
    
}
?>