title: Changing Password PHP to Joomla
body: <p>Hi I am currently using a PHP application which i access through a joomla site through an iframe.</p>
  
  <p>The idea is to get this working with single sign on, which words just fine. </p>
  
  <p>This is the code I have that takes the users password from my own php application and then encodes it to joomla hash</p>
  
  <pre><code>//encrypt password for joomla format
  $salt = "";
  if ($values["password"])
  {
      $password = $values["password"];
      for ($i=0; $i&lt;=32; $i++) 
          {
              $d=rand(1,30)%2;
              $salt .= $d ? chr(rand(65,90)) : chr(rand(48,57));
          } 
      $hashed = md5($password . $salt); $encrypted = $hashed . ':' . $salt;
  </code></pre>
  
  <p>Again this code works just fine, and I later pass it into an insert query.</p>
  
  <p>The problem I am having is when I try to change the password of logged in user from my iframe application, I cant get it to update the joomla user table.</p>
  
  <p>The variables available to me in this particular process are <code>$oldpassword</code> and <code>$newpassword</code>.</p>
  
  <p>Could someone please help me get this working</p>