I am trying to run an application outside Joomla (not as a plugin) and I would like to access the logged in user\'s information (userid). I am wondering how should I go abou
I cannot tell you how Joomla with versions above 1.5 does that but in Joomla 1.5 here is how you do that: ( I am sure for other versions procedure is very similar )
Joomla generates Unique session id for front-end of the website and back-end. To access session data all you need is know the session id.
In joomla configuration file there is a parameter called "secret"
For back-end this is how you generate session id:
$session_id = md5( md5( JConfig::$secret.'administrator' ) );
and for front end:
$session_id = md5( md5( JConfig::$secret.'site' ) );
After this a simple query
mysql_query( 'SELECT `data` FROM jos_session WHERE session_id="'.$sessionId.'" )
will give you access to session data. All you need is to decrypt it with session_decode and session data will be in $_SESSION variable.
Don't forget to put session_start before session_decode otherwise it will not work