Jump to content

Trying to set a local variable with a value from a session


Flyer5
Go to solution Solved by Flyer5,

Recommended Posts

I have a headache trying to solve this!
 
I have a custom php page that uses the normal etano structure, ie custom.php in the root dir calls the html page and css etc. in the skins folder 
The session array exists in all the pages and the values in the array and sess id etc are all correct, as evidenced with a print_r
 
But,
if i use
 
$name = $_SESSION[_LICENSE_KEY_]['user']['user'] ;

(user is a array called user with a value in it called user)

on any page where the array exists
$name is always returned empty.
I expected the above to just extract the value of user from the session and store it locally in $name, but its not retrieving the value, or its not storing it
any ideas you php'ers!
Ta.
Link to comment
Share on other sites

this is it...

 

Array ( [uNEMEXADUWEWUFENAWUGAD] => Array ( [user] => Array ( [skin] => def [user] => ***** [membership] => 4 [prefs] => Array ( [datetime_format] => %m/%d/%Y %I:%M %p [date_format] => %m/%d/%Y [profile_comments] => 1 [rate_my_photos] => 1 [time_offset] => 0 ) [user_id] => 2 [status] => 15 => ***************** [pstat] => 15 [loginout] => 1424507388 [timedout] => Array ( => http:/**********************/home.php [method] => GET [qs] => Array ( ) ) ) )

Link to comment
Share on other sites

Provided the constant  _LICENSE_KEY_  is set to the string  UNEMEXADUWEWUFENAWUGAD  then that line of code you posted should be setting the $name variable to the value of that session variable.

 

When are you using print_r? Directly before the use of that session variable? Do you have error reporting enabled or have you checked your servers error logs?

Link to comment
Share on other sites

  • Solution

Provided the constant  _LICENSE_KEY_  is set to the string  UNEMEXADUWEWUFENAWUGAD  then that line of code you posted should be setting the $name variable to the value of that session variable.

 

Thank you! I was overlooking the obvious, once id uncommented the include for the defines everything worked! couldn't remember commenting it in the first place lol.

Cheers

F5

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.