Flyer5 Posted February 21, 2015 Share Posted February 21, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/294771-trying-to-set-a-local-variable-with-a-value-from-a-session/ Share on other sites More sharing options...
Ch0cu3r Posted February 21, 2015 Share Posted February 21, 2015 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 It would be helpful if you could post this array structure Quote Link to comment https://forums.phpfreaks.com/topic/294771-trying-to-set-a-local-variable-with-a-value-from-a-session/#findComment-1506316 Share on other sites More sharing options...
Flyer5 Posted February 21, 2015 Author Share Posted February 21, 2015 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 ( ) ) ) ) Quote Link to comment https://forums.phpfreaks.com/topic/294771-trying-to-set-a-local-variable-with-a-value-from-a-session/#findComment-1506319 Share on other sites More sharing options...
Ch0cu3r Posted February 21, 2015 Share Posted February 21, 2015 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? Quote Link to comment https://forums.phpfreaks.com/topic/294771-trying-to-set-a-local-variable-with-a-value-from-a-session/#findComment-1506323 Share on other sites More sharing options...
Solution Flyer5 Posted February 21, 2015 Author Solution Share Posted February 21, 2015 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 Quote Link to comment https://forums.phpfreaks.com/topic/294771-trying-to-set-a-local-variable-with-a-value-from-a-session/#findComment-1506354 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.