If you want to get the information about the logged in joomla user in your external script here is the recipe for it:
1. First you need to get the joomla base path eg: http://example.com
So something like below might work or you will have to adjust according to the path of your script file
$joomlaBase = dirname(__FILE__);
define( ‘_JEXEC’, 1 );
define(‘JPATH_BASE’, $joomlaBase);
define( ‘DS’, DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.’includes’.DS.’defines.php’ );
require_once ( JPATH_BASE .DS.’includes’.DS.’framework.php’ );$mainframe =& JFactory::getApplication(‘administrator’);
$mainframe->initialise();
That’s it joomla environment is initialize in your script.
So now for checking logged in user.
if (JFactory::getUser()->id == 0) {
// this means user is not logged in
}
After lot of trial and error above solution worked for me. I have tested in joomla 2.5.6 / 1.6
I got the reference from http://forum.joomla.org/viewtopic.php?f=304&t=580193