Author Topic: access an object in $_SESSION  (Read 1651 times)

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14305
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
access an object in $_SESSION
« on: June 21, 2011, 03:00:16 PM »
I'm just trying to determine if the user is logged into a Joomla site and inside the Session, they have objects that hold the information.  But how do I access those objects?

$_SESSION[$class->$var];

?  Nothing I try seems to work.

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14305
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: access an object in $_SESSION
« Reply #1 on: June 21, 2011, 03:01:13 PM »
Here is the structure of the dump from $_SESSION:
Code: [Select]
Array
(
    [__default] => Array
        (
            [session.counter] => 3
            [session.timer.start] => 1308682834
            [session.timer.last] => 1308682837
            [session.timer.now] => 1308682837
            [session.client.browser] => Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0
            [registry] => JRegistry Object
                (
                    [_defaultNameSpace] => session
                    [_registry] => Array
                        (
                            [session] => Array
                                (
                                    [data] => stdClass Object
                                        (
                                        )

                                )

                        )

                    [_errors] => Array
                        (
                        )

                )

            [user] => JUser Object
                (
                    [id] => 0
                    [name] =>
                    [username] =>
                    [email] =>
                    [password] =>
                    [password_clear] =>
                    [usertype] =>
                    [block] =>
                    [sendEmail] => 0
                    [gid] => 0
                    [registerDate] =>
                    [lastvisitDate] =>
                    [activation] =>
                    [params] =>
                    [aid] => 0

There is more to it but I need to access the stuff in the 'user' object.

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14305
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: access an object in $_SESSION
« Reply #2 on: June 21, 2011, 03:12:08 PM »
Fuck... got the answer on phpfreaks in like 2 minutes.

$_SESSION['__default']['user']->username

Mike

  • Jackass In Charge
  • Posts: 11248
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Re: access an object in $_SESSION
« Reply #3 on: June 21, 2011, 03:48:36 PM »
Sorry was napping :D