title: username and password help in joomla
body: <p>What I'm trying to do here is display my login information and once logged in display something else</p>
  
  <p>Example is here</p>
  
  <pre><code>    &lt;?php
      $user = JFactory::getUser();
      $status = $user-&gt;guest;
  
      if($status == 1){
      echo '
     &lt;form id="login-form" class="form-inline" method="post" action="/home"&gt;
     &lt;div class="topUser"&gt;
          Name: 
          &lt;input id="modlgn-username" class="TopinputReg" type="text" placeholder="User Name" tabindex="0" name="username" /&gt;
        &lt;/div&gt;
        &lt;div class="toppass"&gt;Password: 
          &lt;input id="modlgn-passwd" class="TopinputReg" type="password" placeholder="Password" tabindex="0" name="password" pwfprops="," /&gt;
        &lt;/div&gt;
        &lt;div class="topsignin"&gt;
          &lt;input class="Signin" name="Submit" tabindex="0" type="submit" value="" /&gt;
        &lt;/div&gt;
        &lt;div class="topregister"&gt;
          &lt;a href="http://gamers-league.com/forums/user/register"&gt;&lt;input name="button" type="submit" class="Register" id="button" value="" /&gt;&lt;/a&gt;
                &lt;/div&gt;
      &lt;input type="hidden" value="com_users" name="option"&gt;
      &lt;input type="hidden" value="user.login" name="task"&gt;
      &lt;input type="hidden" value="aW5kZXgucGhwP0l0ZW1pZD0xMzM=" name="return"&gt;
      &lt;input type="hidden" value="1" name="39ea5446d876078c6f6221d396ef5bd4"&gt;
                &lt;/form&gt;
      ';
       }
      else
      {
      echo '
      &lt;div class="topUser"&gt;Welcome Back!&lt;/div&gt;
        &lt;div class="toppass"&gt;Enjoy you stay.&lt;/div&gt;
        &lt;form id="login-form" class="form-vertical" method="post" action="/log-out"&gt;
        &lt;div class="topsignin"&gt;
          &lt;input class="Signout" type="submit" value="" name="Submit" /&gt;
          &lt;input type="hidden" value="com_users" name="option"&gt;
                &lt;/div&gt;
      &lt;input type="hidden" value="com_users" name="option"&gt;
      &lt;input type="hidden" value="user.logout" name="task"&gt;
      &lt;input type="hidden" value="aW5kZXgucGhwP0l0ZW1pZD0xMDE=" name="return"&gt;
      &lt;input type="hidden" value="1" name="994c61f8ab4ccf23fe9dae6546a87089"&gt;
  
        &lt;/form&gt;
        &lt;div class="topregister"&gt;
          &lt;a href="http://gamers-league.com/forums/user"&gt;&lt;input name="button" type="submit" class="account" id="button" value="" /&gt;&lt;/a&gt;
        &lt;/div&gt;
      ';
      }
      ?&gt;
  </code></pre>
  
  <p>No I know what I am doing wrong just have no clue how to fix it. the two </p>
  
  <p>
  </p>
  
  <p>need to have  a different generated number each time but how do i do this. </p>
  
  <p>since this numbers are the same every time if i log in then out then try to log back in it will give me "Invalid Token"</p>
  
  <p>When i go into the login template it gives me 
  this for login</p>
  
  <pre><code>&lt;input type="hidden" name="return" value="&lt;?php echo base64_encode($this-&gt;params-&gt;get('login_redirect_url', $this-&gt;form-&gt;getValue('return'))); ?&gt;" /&gt;
  &lt;?php echo JHtml::_('form.token'); ?&gt;
  </code></pre>
  
  <p>and this for log out </p>
  
  <pre><code>&lt;input type="hidden" name="return" value="&lt;?php echo base64_encode($this-&gt;params-&gt;get('logout_redirect_url', $this-&gt;form-&gt;getValue('return'))); ?&gt;" /&gt;
  &lt;?php echo JHtml::_('form.token'); ?&gt;
  </code></pre>
  
  <p>Now if I replace the hidden fields that already have the pregenerated numbers with the php stuff above when i try to refresh my page it goes completely blank.</p>
  
  <p>I am at a loss with this see as how I am not very advanced in php. any help anyone cant provide would be massively helpful..</p>