views:

134

answers:

2

Hi,

Would anyone have any experience to share and/or sample code that shows accessing the session state information for a user logged into a Joomla web site? Simply showing the logged in user's name or something similar in Silverlight would be very interesting to me.

Thanks

A: 

Joomla tracks session data in a MySQL database, table jos_session. Grab a MySQL DLL and query your Joomla database for the user data.

Jarrod
But there may be many users logged in at once. How would the Silverlight component know which session to look at?
Jimmy
There is one record per session ID. Each record represents one person currently on your site. Pull all the records and look at the data.
Jarrod
Yes, I know it's one row per session... but I still don't know which row to look at. How would the Silverlight component know what is the current joomla session ID, to find the right row?
Jimmy
I don't understand - are you looking for a particular user or all of your users? A user will only have one session ID at a time....
Jarrod
Just the user of the current session -- for example, to have the silverlight component show the user name. I don't know how the silverlight component could find out the current session ID to find the right row in the database.
Jimmy
+1  A: 

Hi Jimmy,

Joomla Session data is stored in your local cookie.

Given that the silverlight app is coming from the same domain(isn't it?!!) as the joomla site, silverlight should be able to access the cookies that joomla saved.

Then you can look at the session table, compare the session id from the cookie, and get your user...

Hope this helps

Overflow