title: integrating my own joomla login to main site
body: <p>I am trying to make my own login form to extend more field information. I try to build it separate from my my site, so I save it to <code>testlogin.php</code> in base Joomla main site directory. Here is my script:</p>
  
  <pre><code>&lt;?php
   define('_JEXEC', 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');
  require_once(JPATH_BASE.DS.'libraries'.DS.'joomla'.DS.'factory.php');
  
  
  $mainframe =&amp; JFactory::getApplication('site');
  $mainframe -&gt;initialise();
  
  $credentials=Array('username' =&gt; 'dadanuser', 'password' =&gt; 'dadan');
  $options=Array('remember' =&gt; true);
  
  $mainframe-&gt;login($credentials, $options); 
  //echo $result;
  $user =&amp; JFactory::getUser();
  echo $user-&gt;username;
  
  $session =&amp; JFactory::getSession();
  $myUser = $session-&gt;set( 'myUser', $user );
  ?&gt;
  </code></pre>
  
  <p>I run it directly and I get login with username: dadanuser, but when I open Joomla main site I still not login yet, maybe I have to set session in right way? </p>
  
  <p>anyone can help ?</p>