-1
How do I check if a session exists and if it exists, redirect to a specific page? I tried it this way, but it’s not working.
<?php
if(isset($_SESSION)){
header('Location: painel.php');
exit();
}
?>
In case my idea is not to let the user return to the login page if he has already logged in to the site.
Dear Jhonatan put the
session_start()
at the beginning of the script. I recommend that you study based on the documentation: https://www.php.net/manual/en/ref.session.php, because you will learn the basics more "correctly"– Guilherme Nascimento