<?php //controller recovery-password



	require_once('../../motormobil/motormobil.php');

    require_once('../../odbconexion/config.php');



	include('../../cookies.php');

	include('../../centinela.php');

	$objeto = new galletas();

	require_once('../../bussines/fix_characters.php');

	$Obj_fix_characters=new fix_characters();

	$password=!empty($_REQUEST['ee11cbb19052e40b07aac0ca060c23ee'])?$_REQUEST['ee11cbb19052e40b07aac0ca060c23ee']:'';

	$password2=!empty($_REQUEST['ee11cbb19052e40b07aac0ca060c23dd'])?$_REQUEST['ee11cbb19052e40b07aac0ca060c23dd']:'';

	$token=!empty($_REQUEST['token'])?$_REQUEST['token']:'';

	$Id_Login=!empty($_REQUEST['Id_Login'])?$_REQUEST['Id_Login']:'';

	if($password==$password2){	

		try{

			for ($c = 1; $c <= 3; $c++) {

			    $password=md5($password);

			}

            	$Odbj_conexion = new odbconexion;

	            $conexion=$Odbj_conexion->openconection();

	            $consulta="UPDATE login_appquadrata SET Login_Password='$password2',Login_Password_Encrypt='$password' WHERE Id_Loginr = '$Id_Login'";

	            $conexion->query($consulta);

	            $consulta="UPDATE recuperar_cuenta_appquadrata SET RC_Password_New='$password2',RC_Password_New_Encrypt='$password',RC_Estatus='Proceso finalizado' WHERE Id_Fk_Login = '$Id_Login' AND RC_Token = '$token'";

	            $conexion->query($consulta);

	            $conexion->close();

	            header('Location: ../recovery-password.php?token='.$token.'&error=2 °');



	    }catch (Exception $e) {

			echo 'Excepcion capturada: ',  $e->getMessage(), "\n";

		}

	}else{

		header('Location: ../recovery-password.php?token='.$token.'&error=1 °');

	}

	?>