PHP: Can't access $_SESSION inside included file


I'm working on a user authentication class in PHP and have encountered some problems with session handling.

This is the basics:

  1. global.php I have a file called global.php that's included at the beginning of each pageload. From this file I also include additional classes used for example the class.uservalidation.php that I'm working on.  I initiate the session in the global.php file.

  3. class.uservalidation.php When this class is instantiated in the beginning of the global.phpfile there is a call to a checkLogin method in the constructor that checks the session variables emailand hash and if they match it will set the auth property to the level of the selected user.

  5. login.php is the login page (obviously...) and when submitted this will call the login method of the uservalidation class. This method will set two session variables email and hash when there's a successful login.

  7. index.php is the default landing page that will show different content depending on the login status


And this is an example of how it works:

I go to login.php. Session is started