1
I have a page login.php
which after being filled goes to the processa.php
and then enter the session and cookie:
$cookie_name = "Administrador";
$cookie_value = $id;
setcookie($cookie_name, $cookie_value, time() + (3600), "/");
$_SESSION['user'] = $id;
header("Refresh: 0; url=MENU/menu.php");
And on the page login.php
, i wanted to do something like, if the user who has already logged in, want to go back to the site, and go to the login, the login checks if the session still exists and sends it back to the menu.php
. I did it this way but it doesn’t seem to work:
<?
session_start();
if(!isset($_SESSION['user']))
{
setcookie("Administrador");
session_destroy();
}else
{
$user = $_SESSION['user'];
header("MENU/menu.php");
}
?>
Try it like this:
header("Location: MENU/menu.php");
– Ivan Ferrer
I always used a refresh header that I forgot Location existed! I was embarrassed! Thanks for reminding me Van.
– programmer2016