<?php
// Output buffering to prevent premature output
ob_start();

// Start the session
session_start();

// Destroy the session
session_destroy();

// Redirect to the index page
header("Location: index.php");

// Ensure no further code is executed after the header redirect
exit();
ob_end_flush();
?>