I am just trying to write some code to check if the session is exist. If the answer is no, redirect the page to the login page. Moreover I want to write this code for multiple website. So that whatever the domain name is never be a fact for me. here I write some codes:
//$_SESSION['license'] -> this will be created after anyone log in
//and will be set its value to 15497852.
if(isset($_SESSION['license']) && $_SESSION['license'] == '15497852'){
    // DO SOMETHING
} else {
    // here i want to create link like: http://stackoverflow.com/?df=login
    header('Location: '.$_SERVER['PHP_SELF'].'?df=login');
    die();
}
but this code is not working where I am not seeing anything wrong.
 
    