Jump to content

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


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.

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 ( ) ) ) )

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?

  On 2/21/2015 at 12:04 PM, Ch0cu3r said:

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.