I'm coding a "users-only" access for a site, and when the user is not logged in the dashboard is redirecting to the login page.
<?php
session_start();
$logged= $_SESSION['logged'];
if(!$logged){
header("Location:http://www.someweb.com/system/login.php?logged_off=1");
}
?>
but the login page is not receiving the GET variable, can you please tell what am I doing wrong?
When using header location, you should call
exit();
Why? Because the script's execution will not be terminated.
Parentheses
()
are optional,exit
is a language construct not a function, and they actually are a bad idea (PHP has more work to do if they exist), just a terrible habit I have.