I have a question with Sessions in PHP. I have a page called principal.php which is a login and if you do the correct login it takes you to a page called messenger.php, and in the messenger page when closing session does not close it, you can re-enter directly with the link messenger.php
Check to see if the session started:
session_start();
if (isset($_SESSION['login']))
{
echo "Bienvenido: " . $_SESSION['login'];
}
else
{
header("Location: principal.php");
}
<?php
session_start();
// remove all session variables
session_unset();
// destroy the session
session_destroy();
header("Location: principal.php")
?>
I close the session but you can still access messenger.php directly with the link without having to log in. Can someone help me please?