<?php
/**
 * Parent Logout
 * Clears session and redirects to parent login page
 */

// Start session if not already started
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

// Clear all session variables
$_SESSION = array();

// Destroy session cookie
if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time() - 3600, '/');
}

// Destroy the session
session_destroy();

// Redirect to parent login page with logout success message
header('Location: parent_login.php?logout=success');
exit;
?>
