session_is_registered gives you back true or false:
if(session_is_registered()==false) // this will test you that session has been started jet
$chronerr->halt(22,"Session Management"); //but you have to start session somewhere! session_start();
You can't use session_start/header location after you have already sent content to the browser.
if FileName is a session variable use $SESSION["FileName"] , if it's not then use the $GET or $_POST
then:
if(empty($_SESSION["loggedin"]) AND $_SESSION["FileName"] != "login")
header("Location: login.php");
And please use the
[code=php]
[/code] codes around your php codes, thank you.