<?php

	//-----------------------------------------------------------------------------
	session_start();

	//-----------------------------------------------------------------------------
	include("../M0/get_parameters.php") ;
	
	//-----------------------------------------------------------------------------
	if ( ! empty( $_POST['SMS_CODE'] ) ) {
		
		if ( password_verify( $_POST['SMS_CODE'], $_SESSION['lost_code_2FA_hashed'] ) ) {
			
			if ( $_SESSION['lost_code_2FA_t_limit'] >= time() ) {
				$_SESSION['lost_code_2FA_msg'] = "";
				$_SESSION['lost_2FA_code_erreur'] = 22 ;
				$_SESSION['lost_admin_2FA'] = true ;
				header('Location: ./lost_password_super_user_execute.php');
				exit();
			}
			else {
				$_SESSION['lost_code_2FA_msg'] = "code correct mais périmé !!!";
				$_SESSION['lost_2FA_code_erreur'] = 23 ;
				$_SESSION['lost_admin_2FA'] = false ;
				header('Location: ./lost_get_admin_2fa_code.php');
				exit();
			}
		}
		else {
			$_SESSION['lost_code_2FA_msg'] = "code incorrect !!!";
			$_SESSION['lost_2FA_code_erreur'] = 24 ;
			$_SESSION['lost_admin_2FA'] = false ;
			header('Location: ./lost_get_admin_2fa_code.php');
			exit();
		}
			
	}
	else {
		$_SESSION['lost_code_2FA_msg'] = "veuillez saisir un code à 6 chiffres !";
		$_SESSION['lost_2FA_code_erreur'] = 25 ;
		$_SESSION['lost_admin_2FA'] = false ;
		header('Location: ./lost_get_admin_2fa_code.php');
		exit();
	}
	
?>
	

	
