Dashboard
The dashboard.php file is the main entry point for the PriviMetrics Admin Dashboard.
It is responsible for initializing the system, securing the admin session, loading data, and rendering the dashboard interface.
Purpose of this file
This file:
-
loads system configuration
-
starts and secures the admin session
-
validates admin authentication
-
enforces session timeout
-
loads dashboard logic
-
prepares statistical data
-
renders the HTML admin panel
Included files
| File | Purpose |
|---|---|
settings-config.php |
Optional system & user settings |
config.php |
Main system configuration |
functions.php |
Utility and security functions |
storage.php |
Data storage layer |
new_version.php |
System update checker |
assets/dashboard-logic.php |
Dashboard data processing |
assets/dashboard-template.php |
Dashboard HTML view |
Security mechanisms
Secure session start
startSecureSession();
Starts the session using hardened security settings (secure cookies, HttpOnly, etc.).
Admin login validation
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] !== true)
If the admin is not logged in:
-
the session is destroyed
-
the user is redirected to
admin.php(login screen)
Session timeout
$sessionTimeout = $config['session_timeout'] ?? 86400;
Default: 24 hours (86400 seconds)
If the session exceeds this time:
-
the session is destroyed
-
the user is redirected to
admin.php?timeout=1
Activity tracking
$_SESSION['last_activity'] = time();
Used to track admin activity and prevent idle sessions from staying alive.
Dashboard data initialization
$dashboardData = initializeDashboard($config, $settings);
extract($dashboardData);
The initializeDashboard() function (from dashboard-logic.php) gathers:
-
visitor and analytics data
-
user statistics
-
logs
-
system health info
-
license and version status
extract() converts the returned array into variables used inside the HTML template.
Dashboard rendering
Finally:
require_once 'assets/dashboard-template.php';
This loads the HTML UI that displays:
-
charts
-
tables
-
alerts
-
system info
All data comes from $dashboardData.
Execution flow
User opens /dashboard.php
↓
Config files are loaded
↓
Secure session is started
↓
Admin login is validated
↓
Session timeout is checked
↓
Dashboard data is loaded
↓
HTML template is rendered
↓
Admin panel is displayed