<?	session_start();
	$Id=$_SESSION['id_usuario'];
	if(!isset($_SESSION['nombre'])){
		header("../index.php"); /* Si no hay sesion vamos al login.php */
	} else {
	
	$Actual = $_POST["actual"];
	$Nueva1 = $_POST["nueva1"];
	$Nueva2 = $_POST["nueva2"];
	
	if ($Nueva2 != $Nueva1) {
		header("Location: pass.php?Error=1");
		exit;
	}
	
	include_once('../includes/Conexion.inc.php');
	
	Conectar();
	
	$sql = "Select Id, Mail, Pass, Nombre, Apellido, Categoria from Usuarios where Id = '$Id'";
  	$res = mysql_query($sql);
	if (mysql_num_rows($res)==0) {
 		Desconectar();
		header("Location: pass.php?Error=2");
		exit;
	}
	list($Id,$Mail,$Pass, $Nombre, $Apellidos, $Categoria) = mysql_fetch_row($res);
	if ($Pass != $Actual) {
		Desconectar();
		header("Location: pass.php?Error=2");
		exit;
	}else{

	
		$sql = "Update Usuarios Set ";

		$sql = $sql .  "Pass = '$Nueva1'";
			
		$sql = $sql . " where Id = $Id";

		mysql_query($sql);
	}
	Desconectar();
	header("location:../index.php?Pass=1");
	exit;
	}