| Path : /home/vishqocm/pcib.in/admin/includes/ |
| Current File : /home/vishqocm/pcib.in/admin/includes/check_login.php |
<?php
/**
* This file checks if the user is logged in and redirects to the login page if not.
* It's meant to be included by other pages that require authentication.
*/
// Start session if not already started
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
// Check if user is logged in
if (!isset($_SESSION['admin_id']) || empty($_SESSION['admin_id'])) {
// User is not logged in, redirect to login page
header("Location: login.php");
exit();
}