Problem with session variable

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am building a site and i want to password protect some pages. In
order to do this i use this variable: $_SESSION['validated'] and i set
it to true when a user has logged in. So in one file when a user has
logged in i have the following:

I am trying to check if this variable is set to true in some other file
like this:
if ( isset($_SESSION['validated']) && $_SESSION['validated']==true )
   /*Do something else*/
The problem is it seems i cannot access the $_SESSION['validated'] in
other files than the one i set it. What is the solution to this
problem? Please help

Re: Problem with session variable

I bet the session is not being started. Remove the @ infront of
session_start() and report back if there are any errors. For the
session stuff to work the headers need to be set. So if you are
printing anything out before the session_start() then it fails. That
even includes any space between the begining of a file and the <?.

Site Timeline