Fredrik Tillman wrote:
ok.. Let me explain the problem better.
'user_level' is set by a login script. It seems to be working fine since
I can make things like:
if ("1"==$_SESSION[user_level]) { let this stuff happen }
$_SESSION[user_level] is wrong unless 'user_level' is a defined constant
in your code (I bet it isn't).
instead write: $_SESSION['user_level']
-- notice the quotes, they delimit the _string_ that is the key of the
array. array keys are either strings or integers.
on my mainpage.
on that same mainpage I use
include ("page.php");
(I also tried require...)
If I access page.php directly (by writing the URL in my browser) things
like
if ("1"==$_SESSION[user_level]) { let this stuff happen }
will work just fine, but when page.php is included in mainpage the
$_SESSION[user_level] is empty for that included part...
how is $_SESSION['user_level'] being set and/or updated?
have you tried a var_dump($_SESSION) on the included page to
see what _is_) in the session?
are you per change closing the session prior to including the relevant file?
I think you'll need to show some code - the way you describe it seems
to me to be not possible that $_SESSION['user_level'] is set in the first script
and nolonger available in the included script ($_SESSION is a super global
that is available everywhere so long as there is an active/open session)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php