Now i have the following to check if a user is logged in:
Code: Select all
define( '_JEXEC', 1 );
define( '_VALID_MOS', 1 );
define('JPATH_BASE', dirname(__FILE__));
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
/* Create the Application */
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
/* Make sure we are logged in at all. */
if (JFactory::getUser()->id == 0)
die("You have to be logged in.");
Code: Select all
$name = JFactory::getUser()->username;
How can i solve this so that it works for all the users?