title: How can I access login user data using external files in joomla 2.5?
body: <p>I am having trouble in accessing the data of the login user in joomla site.
  Can someone help me on it?</p>
  
  <p>I've tried this code:</p>
  
  <pre><code>define( '_JEXEC', 1 );
  define( 'DS', '/' );
  define( 'JPATH_BASE', $_SERVER[ 'DOCUMENT_ROOT' ] );
  require_once( JPATH_BASE . DS .'xampp' . DS .'UPOnlineLeave '. DS .'includes' . DS . 'defines.php' );
  require_once( JPATH_BASE . DS .'xampp' . DS .'UPOnlineLeave '. DS . 'includes' . DS . 'framework.php' );
  require_once( JPATH_BASE . DS .'xampp' . DS .'UPOnlineLeave '. DS . 'libraries' . DS . 'joomla' . DS . 'factory.php' );
  $mainframe =&amp; JFactory::getApplication('site');
  $mainframe-&gt;initialise();
      $user =&amp; JFactory::getUser();
      $session =&amp; JFactory::getSession();
  $user-&gt;username;
  </code></pre>
  
  <p>but it produces <code>JOSerror:application instantation error</code>.</p>
  
  <p>Can someone help me?</p>