<?php
  $pass0=getParam('pass0');
  $pass1=getParam('pass1');
  $pass2=getParam('pass2');
  $pass0md5=md5($pass0);
  $pass1md5=md5($pass1);
  $pass2md5=md5($pass2);  
  $result=mysql_query("select * from users where id='".$current_id."'",$link);
  $row=mysql_fetch_array($result);
  $password_actual=$row["password"];
  mysql_free_result($result);
  $err='';
  $ok='';
  if ($password_actual == $pass0md5){
    if (($pass1md5) == ($pass2md5)){
      $result=mysql_query("update users set password=\"".$pass1md5."\" where id=\"".$current_id."\"",$link);
      $ok='si';
      $_SESSION["pass"]=$pass1md5;
    }else{
      $err="Les dues claus entrades son diferents";
    }
  }else{
    $err="Clau actual incorrecta";
  }	
  include("pass.php");
?>
