/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php //http://domain.com/script/script.php?username=username&passwd=password require_once('../configuration.php'); require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); require_once ( JPATH_BASE .DS.'libraries'.DS.'joomla'.DS.'factory.php' ); /* Create the Application */ $mainframe =& JFactory::getApplication('site'); jimport('joomla.plugin.helper'); $credentials['username'] = JRequest::getVar('username', '', 'method', 'username'); $credentials['password'] = JRequest::getVar('passwd', '', 'method', 'passwd'); //preform the login action $error = $mainframe->login($credentials); $user = JFactory::getUser(); //now you are log in $mainframe->logout(); //now you are log out
URL: http://stackoverflow.com/questions/2075335/how-to-log-into-joomla-through-an-external-script