<?php
 
	//---------------------------------------------------------------------------------------------
	session_cache_limiter('private,max-age=6');
	session_start();

	include("../M0/get_parameters.php") ;
	include("../M0/batiments_niveaux.php") ;
	
	//---------------------------------------------------------------------------------------------
	// On teste si la variable de session existe et contient une valeur
	// Si inexistante ou nulle, on redirige vers le formulaire de login
	//---------------------------------------------------------------------------------------------
	if ( empty($_SESSION['login']) ) {
		header('Location: ' . $root_dir . '/M1/login.php');
	} 

	//---------------------------------------------------------------------------------------------
	$FLAG_DISPLAY_DEBUG = true; 
	$FLAG_DISPLAY_DEBUG = false;

	$FLAG_DISPLAY_SESSION = true;
	$FLAG_DISPLAY_SESSION = false;

	include("../M0/logging.php");
	include("../M0/logging_function.php");

	//---------------------------------------------------------------------------------------------
	// mise à jour des variables de session si elles sont en GET ou POST
	//---------------------------------------------------------------------------------------------

	//---------------------------------------------------------------------------------------------
	// GET
	//---------------------------------------------------------------------------------------------
	if ( ! empty($_GET) ) {
		
		if ( ! empty( $_GET['USER_OF_1_SITE_ID'] ) ) {
			$_SESSION['target_user_id'] = $_GET['USER_OF_1_SITE_ID'];
		}
		
		if ( ! empty( $_GET['TARGET_ADMIN_ID'] ) ) {
			if ( $_GET['TARGET_ADMIN_ID'] == "pas_de_choix" ) {
				$_SESSION['target_admin_id'] = "none";
			}
			else {
				$_SESSION['target_admin_id'] = $_GET['TARGET_ADMIN_ID'];
			}
		}
	}
		
	//---------------------------------------------------------------------------------------------
	// POST
	//---------------------------------------------------------------------------------------------
	if ( ! empty($_POST) ) {
		
		$DO_MODIFY = true;

		//---------------------------------------------------------------------------------------------
		// CHECK BOXES
		//---------------------------------------------------------------------------------------------
		$_SESSION['UPDATE_CO2_BIQUO']	= isset( $_POST['UPDATE_CO2_BIQUO'] )	? true	: false ;
		$_SESSION['aqcm_SCH_STAT']		= isset( $_POST['scheduled_status'] )	? true	: false ;

		//---------------------------------------------------------------------------------------------
		// changement de préfixe : aqcm_PREFIXE
		//---------------------------------------------------------------------------------------------
		if ( ( ! empty( $_POST['aqcm_PREFIXE'] ) ) && ( $DO_MODIFY ) ) {
			if ( $_POST['aqcm_PREFIXE'] != $_SESSION['aqcm_PREFIXE'] ) {
				$DO_MODIFY = false;
				$_SESSION['aqcm_PREFIXE']	= $_POST['aqcm_PREFIXE'] ;
				include("../M0/selection_SITE_ID.php");
				$_SESSION['aqcm_BAT']		= "B99";
				$_SESSION['aqcm_NIVEAU']	= "N99";
				include("../M0/get_sondes.php");
				if ( $NB_sondes > 0 ) {
					$_SESSION['SONDE_MAC']		= $aqcm_MAC[0];
				}
				else {
					$_SESSION['SONDE_MAC']		= "00_00_00_00_00_00";
				}
				include("../M0/get_parameters_of_session_sonde.php") ;
			}
		}

		//---------------------------------------------------------------------------------------------
		// changement de site : select_site_id
		//---------------------------------------------------------------------------------------------
		if ( ( ! empty( $_POST['select_site_id'] ) ) && ( $DO_MODIFY ) ) {
			
			if ( $_POST['select_site_id'] != $_SESSION['SITE_ID'] ) {
				$DO_MODIFY = false;
				$_SESSION['SITE_ID'] 		= $_POST['select_site_id'] ;
				$_SESSION['aqcm_BAT']		= "B99";
				$_SESSION['aqcm_NIVEAU']	= "N99";
				
				include("../M0/get_sondes.php") ;
				if ( $NB_sondes > 0 ) {
					$_SESSION['SONDE_MAC']		= $aqcm_MAC[0];
				}
				else {
					$_SESSION['SONDE_MAC']		= "00_00_00_00_00_00";
				}
				include("../M0/get_parameters_of_session_sonde.php") ;
			}
		}
		
		//---------------------------------------------------------------------------------------------
		// changement de bâtiment : aqcm_BAT
		//---------------------------------------------------------------------------------------------
		if ( ( ! empty( $_POST['aqcm_BAT'] ) ) && ( $DO_MODIFY ) ) {
			if ( $_POST['aqcm_BAT'] != $_SESSION['aqcm_BAT'] ) {
				$DO_MODIFY = false;
				$_SESSION['aqcm_BAT'] 		= $_POST['aqcm_BAT'] ;
				$_SESSION['aqcm_NIVEAU']	= "N99";
				include("../M0/get_sondes.php") ;
				if ( $NB_sondes > 0 ) {
					$_SESSION['SONDE_MAC']		= $aqcm_MAC[0];
				}
				else {
					$_SESSION['SONDE_MAC']		= "00_00_00_00_00_00";
				}
				include("../M0/get_parameters_of_session_sonde.php") ;
			}
		}
		
		//---------------------------------------------------------------------------------------------
		// changement de niveau : aqcm_NIVEAU
		//---------------------------------------------------------------------------------------------
		if ( ( ! empty( $_POST['aqcm_NIVEAU'] ) ) && ( $DO_MODIFY ) ) {
			if ( $_POST['aqcm_NIVEAU'] != $_SESSION['aqcm_NIVEAU'] ) {
				$DO_MODIFY = false;
				$_SESSION['aqcm_NIVEAU'] = $_POST['aqcm_NIVEAU'] ;
				include("../M0/get_sondes.php") ;
				if ( $NB_sondes > 0 ) {
					$_SESSION['SONDE_MAC']		= $aqcm_MAC[0];
				}
				else {
					$_SESSION['SONDE_MAC']		= "00_00_00_00_00_00";
				}
				include("../M0/get_parameters_of_session_sonde.php") ;
			}
		}

		//---------------------------------------------------------------------------------------------
		// changement de sonde : aqcm_SONDE_PARAMS
		//---------------------------------------------------------------------------------------------
		if ( ! empty( $_POST['aqcm_SONDE_PARAMS'] ) ) {
			
			$koko = explode( ",", $_POST['aqcm_SONDE_PARAMS']) ;
			if ( $koko[0] != $_SESSION['SONDE_MAC'] ) {
				$_SESSION['SONDE_MAC']	= $koko[0] ;
			}
			include("../M0/get_parameters_of_session_sonde.php") ;
			
		}
		
		//---------------------------------------------------------------------------------------------
		if ( isset($_POST["ONE_SONDE_DISPLAY_MODE"]) ) {
			$_SESSION['SONDE_DISPLAY_MODE'] = $_POST["ONE_SONDE_DISPLAY_MODE"];
		}


		//---------------------------------------------------------------------------------------------
		if ( ! empty( $_POST['aqcm_target_admin_id'] ) ) {
			$_SESSION['target_admin_id'] = $_POST['aqcm_target_admin_id'] ;
		}

		if ( ! empty( $_POST['aqcm_target_user_id'] ) ) {
			$_SESSION['target_user_id'] = $_POST['aqcm_target_user_id'] ;
		}

		if ( ! empty( $_POST['aqcm_ANNEE'] ) ) {
			$_SESSION['aqcm_ANNEE'] = $_POST['aqcm_ANNEE'] ;
		}

		if ( ! empty( $_POST['aqcm_MOIS'] ) ) {
			$_SESSION['aqcm_MOIS'] = $_POST['aqcm_MOIS'] ;
		}

		if ( ! empty( $_POST['aqcm_JOUR'] ) ) {
			$_SESSION['aqcm_JOUR'] = $_POST['aqcm_JOUR'] ;
		}

		if ( ! empty( $_POST['echelle_temps'] ) ) {
			$_SESSION['aqcm_T_SCALE'] = $_POST['echelle_temps'] ;
		}

		if ( ! empty( $_POST['presence'] ) ) {
			$_SESSION['PRESENCE'] = $_POST['presence'] ;
		}

		if ( ! empty( $_POST['aqcm_NB_WEEKS'] ) ) {
			$_SESSION['aqcm_NB_WEEKS'] = $_POST['aqcm_NB_WEEKS'] ;
		}

		if ( ! empty( $_POST['GRAPH_T_SEUIL']  ) )	{ 
			if ( is_numeric($_POST['GRAPH_T_SEUIL']) ) $_SESSION['GRAPH_T_SEUIL'] = $_POST['GRAPH_T_SEUIL'] ; 
		}

		if ( ! empty( $_POST['GRAPH_HR_SEUIL']  ) )	{ 
			if ( is_numeric($_POST['GRAPH_HR_SEUIL']) ) $_SESSION['GRAPH_HR_SEUIL'] = $_POST['GRAPH_HR_SEUIL'] ; 
		}

		//---------------------------------------------------------------------------------------------
		if ( ! empty( $_POST['aqcm_SPL_TRIG_MOY'] ) ) 			{ $_SESSION['aqcm_SPL_TRIG_MOY'] 			= $_POST['aqcm_SPL_TRIG_MOY'] ; }
		if ( ! empty( $_POST['aqcm_SPL_TRIG_MAX'] ) ) 			{ $_SESSION['aqcm_SPL_TRIG_MAX'] 			= $_POST['aqcm_SPL_TRIG_MAX'] ; }
		if ( ! empty( $_POST['aqcm_CO2_TRIG_LOW'] ) ) 			{ $_SESSION['aqcm_CO2_TRIG_LOW'] 			= $_POST['aqcm_CO2_TRIG_LOW'] ; }
		if ( ! empty( $_POST['aqcm_CO2_TRIG_HIGH'] ) ) 		{ $_SESSION['aqcm_CO2_TRIG_HIGH'] 		= $_POST['aqcm_CO2_TRIG_HIGH'] ; }
		if ( ! empty( $_POST['aqcm_SPL_TRIG_MODE_BIQUO'] ) )	{ $_SESSION['aqcm_SPL_TRIG_MODE_BIQUO']	= $_POST['aqcm_SPL_TRIG_MODE_BIQUO'] ; }
		if ( ! empty( $_POST['aqcm_SCHEDULER'] ) ) 				{ $_SESSION['aqcm_SCHEDULER']				= $_POST['aqcm_SCHEDULER'] ; }

	}

	//---------------------------------------------------------------------------------------------
	/*
	if ( $FLAG_DISPLAY_DEBUG ) {
		echo( "aqcm_PREFIXE = " 		. $_SESSION['aqcm_PREFIXE'] ) ; 	echo("<br>");
		echo( "SITE_ID = " 				. $_SESSION['SITE_ID'] ) ; 	echo("<br>");
		echo( "AQCM_BAT = " 				. $_SESSION['aqcm_BAT'] ) ; 	echo("<br>");
		echo( "AQCM_NIVEAU = " 			. $_SESSION['aqcm_NIVEAU'] ) ; 	echo("<br>");
		echo( "SONDE_MAC = " 			. $_SESSION['SONDE_MAC'] ) ; 	echo("<br>");
		echo( "SONDE_NAME = " 			. $_SESSION['SONDE_NAME'] ) ; 	echo("<br>");
		echo("</br>");
	}
	*/
	
	//---------------------------------------------------------------------------------------------
	// création des variables de session par défaut
	//---------------------------------------------------------------------------------------------
	$_SESSION['CACHE_NAVIGATEUR']				= isset($_SESSION['CACHE_NAVIGATEUR'] ) ? $_SESSION['CACHE_NAVIGATEUR'] : "cache_enabled";

	//---------------------------------------------------------------------------------------------
	// SONDE
	//---------------------------------------------------------------------------------------------
	$_SESSION['SONDE_MAC']						= isset($_SESSION['SONDE_MAC'] )		? $_SESSION['SONDE_MAC']		: "00_00_00_00_00_00";
	$_SESSION['SONDE_MAC_OLD']					= isset($_SESSION['SONDE_MAC_OLD'] )	? $_SESSION['SONDE_MAC_OLD']	: "00_00_00_00_00_00";
	$_SESSION['SONDE_NAME']						= isset($_SESSION['SONDE_NAME'] )		? $_SESSION['SONDE_NAME']		: "sans_nom";
	$_SESSION['SONDE_MESURES']					= isset($_SESSION['SONDE_MESURES'] )	? $_SESSION['SONDE_MESURES']	: "YYYNNNNNNN";
	$_SESSION['SONDE_BAT']						= isset($_SESSION['SONDE_BAT'] )		? $_SESSION['SONDE_BAT']		: "B99";
	$_SESSION['SONDE_NIVEAU']					= isset($_SESSION['SONDE_NIVEAU'] )	? $_SESSION['SONDE_NIVEAU']	: "N99";
	$_SESSION['SONDE_T_MAX']					= isset($_SESSION['SONDE_T_MAX'] )		? $_SESSION['SONDE_T_MAX']	: "1999999999";
	$_SESSION['SONDE_SPL_TRIG_MODE_BIQUO']	= isset($_SESSION['SONDE_SPL_TRIG_MODE_BIQUO'] )		? $_SESSION['SONDE_SPL_TRIG_MODE_BIQUO']		: "SPL_ONLY";
	$_SESSION['SONDE_SPL_TRIG_MOY']			= isset($_SESSION['SONDE_SPL_TRIG_MOY'] )		? $_SESSION['SONDE_SPL_TRIG_MOY']		: "35.0";
	$_SESSION['SONDE_SPL_TRIG_MAX']			= isset($_SESSION['SONDE_SPL_TRIG_MAX'] )		? $_SESSION['SONDE_SPL_TRIG_MAX']		: "55.0";
	$_SESSION['SONDE_SCHEDULER']				= isset($_SESSION['SONDE_SCHEDULER'] )		? $_SESSION['SONDE_SCHEDULER']		: 	"000000000000000000000000000000000000000000000000111111111111111111111111000000000111111111111111111111111000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000111111111111111111111111000000000111111111111111111111111000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000111111111111111111111111000000000111111111111111111111111000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000111111111111111111111111000000000111111111111111111111111000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000111111111111111111111111000000000111111111111111111111111000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
	;
	$_SESSION['SONDE_CO2_TRIG_LOW']			= isset($_SESSION['SONDE_CO2_TRIG_LOW'] )		? $_SESSION['SONDE_CO2_TRIG_LOW']		: "800";
	$_SESSION['SONDE_CO2_TRIG_HIGH']			= isset($_SESSION['SONDE_CO2_TRIG_HIGH'] )		? $_SESSION['SONDE_CO2_TRIG_HIGH']		: "1500";
	$_SESSION['SONDE_RX_WARNING_EN']			= isset($_SESSION['SONDE_RX_WARNING_EN'] )		? $_SESSION['SONDE_RX_WARNING_EN']		: "OFF";

	$_SESSION['SONDE_DISPLAY_MODE'] = isset($_SESSION['SONDE_DISPLAY_MODE'] ) ? $_SESSION['SONDE_DISPLAY_MODE'] : "multimetres";

	//---------------------------------------------------------------------------------------------
	// SITE
	//---------------------------------------------------------------------------------------------
	$_SESSION['SITE_ID']			= isset($_SESSION['SITE_ID'] )			? $_SESSION['SITE_ID']  		: "00001_001";
	$_SESSION['SITE_ID_OLD']	= isset($_SESSION['SITE_ID_OLD'] )	? $_SESSION['SITE_ID_OLD']  	: "00001_001";
	$_SESSION['SITE_NAME']		= isset($_SESSION['SITE_NAME'] )		? $_SESSION['SITE_NAME']  		: "sans_nom";
	$_SESSION['SITE_LON']		= isset($_SESSION['SITE_LON'] )		? $_SESSION['SITE_LON']  		: "0.000000";
	$_SESSION['SITE_LAT']		= isset($_SESSION['SITE_LAT'] )		? $_SESSION['SITE_LAT']  		: "0.000000";
	$_SESSION['aqcm_BAT']		= isset($_SESSION['aqcm_BAT'] )		? $_SESSION['aqcm_BAT']			: "B99";
	$_SESSION['aqcm_NIVEAU']	= isset($_SESSION['aqcm_NIVEAU'] )	? $_SESSION['aqcm_NIVEAU']			: "N99";
	$_SESSION['aqcm_PREFIXE']	= isset($_SESSION['aqcm_PREFIXE'] )	? $_SESSION['aqcm_PREFIXE']		: "00";

	$_SESSION['PRESENCE']		= isset($_SESSION['PRESENCE'] )		? $_SESSION['PRESENCE']			: "sonde";

	$maintenant  					= mktime(0, 0, 0, date("m")  , date("d") -1, date("Y"));
	$_SESSION['aqcm_ANNEE']		= isset($_SESSION['aqcm_ANNEE'] ) 	? $_SESSION['aqcm_ANNEE']		: date("Y", $maintenant);
	$_SESSION['aqcm_MOIS']		= isset($_SESSION['aqcm_MOIS'] ) 		? $_SESSION['aqcm_MOIS']		: date("m", $maintenant);
	$_SESSION['aqcm_JOUR']		= isset($_SESSION['aqcm_JOUR'] ) 		? $_SESSION['aqcm_JOUR']		: date("d", $maintenant);
	$_SESSION['aqcm_NB_WEEKS']	= isset($_SESSION['aqcm_NB_WEEKS'] )	? $_SESSION['aqcm_NB_WEEKS']	: 1 ;
	$_SESSION['aqcm_T_SCALE']	= isset($_SESSION['aqcm_T_SCALE'] ) 	? $_SESSION['aqcm_T_SCALE']	: "2 jours";
	$_SESSION['aqcm_SCH_STAT']	= isset($_SESSION['aqcm_SCH_STAT'] )	? $_SESSION['aqcm_SCH_STAT']	: false;

	$_SESSION['UPDATE_CO2_BIQUO']	= isset($_SESSION['UPDATE_CO2_BIQUO'] )	? $_SESSION['UPDATE_CO2_BIQUO']	: false ;

	$_SESSION['aqcm_CO2_TRIG_LOW']			= isset($_SESSION['aqcm_CO2_TRIG_LOW'] )			? $_SESSION['aqcm_CO2_TRIG_LOW']	: "800";
	$_SESSION['aqcm_CO2_TRIG_HIGH']			= isset($_SESSION['aqcm_CO2_TRIG_HIGH'] )			? $_SESSION['aqcm_CO2_TRIG_HIGH']	: "1500";
	$_SESSION['aqcm_SPL_TRIG_MOY']			= isset($_SESSION['aqcm_SPL_TRIG_MOY'] )			? $_SESSION['aqcm_SPL_TRIG_MOY']	: "35.0";
	$_SESSION['aqcm_SPL_TRIG_MAX']			= isset($_SESSION['aqcm_SPL_TRIG_MAX'] )			? $_SESSION['aqcm_SPL_TRIG_MAX']	: "55.0";
	$_SESSION['aqcm_SPL_TRIG_MODE_BIQUO']	= isset($_SESSION['aqcm_SPL_TRIG_MODE_BIQUO'] )	? $_SESSION['aqcm_SPL_TRIG_MODE_BIQUO']	: "SPL_ONLY";
	$_SESSION['aqcm_SCHEDULER']				= isset($_SESSION['aqcm_SCHEDULER'] )				? $_SESSION['aqcm_SCHEDULER']	: 	"000000000000000000000000000000000000000000000000111111111111111111111111000000000111111111111111111111111000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000111111111111111111111111000000000111111111111111111111111000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000111111111111111111111111000000000111111111111111111111111000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000111111111111111111111111000000000111111111111111111111111000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000111111111111111111111111000000000111111111111111111111111000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".
	"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
	;

	if ( ! isset($_SESSION['GRAPH_T_SEUIL'] ) ) 		$_SESSION['GRAPH_T_SEUIL'] 	= "19.0" ;
	if ( ! isset($_SESSION['GRAPH_HR_SEUIL'] ) ) 		$_SESSION['GRAPH_HR_SEUIL'] 	= "50.0" ;
	if ( ! isset($_SESSION['aqcm_HYGRO_THERMO'] ) )	$_SESSION['aqcm_HYGRO_THERMO']	= "ON" ;

	include("../M0/get_parameters_of_session_sonde.php") ;
	
	$_SESSION['ONE_SONDE_CONSULT_ERREUR'] = isset($_SESSION['ONE_SONDE_CONSULT_ERREUR'] )	? $_SESSION['ONE_SONDE_CONSULT_ERREUR']	: "" ;
	
	//---------------------------------------------------------------------------------------------
	// recensement des sites
	//---------------------------------------------------------------------------------------------
	include ("../M0/get_AQCM05_sites.php");
	
	$all_sites_id_strings 				= $sites_from_AQCM05_SITES_LIST ;
	$all_sites_names_strings 			= $sites_from_AQCM05_SITES_NAMES ;
	$all_sites_status_strings			= $sites_from_AQCM05_SITES_STATUS ;
	$all_sites_t_max_strings			= $sites_from_AQCM05_SITES_T_MAX ;
	$all_sites_nb_max_strings			= $sites_from_AQCM05_SITES_NB_MAX ;
	$all_sites_rx_warning_en_strings	= $sites_from_AQCM05_SITES_RX_WARNING_EN ;
	$all_sites_lon_strings 				= $sites_from_AQCM05_SITES_LON ;
	$all_sites_lat_strings 				= $sites_from_AQCM05_SITES_LAT ;
	$all_sites_ibm_strings 				= $sites_from_AQCM05_SITES_IBM ;

	$_SESSION['base_users']  	= "AQCM05_SITE_" . $_SESSION['SITE_ID'] ;
			
	//---------------------------------------------------------------------------------------------
	if ( $_SESSION['user_type'] == "super_user" ) {

		//---------------------------------------------------------------------------------------------
		// mise à jour des paramètres du super_user connecté depuis MySQL
		//---------------------------------------------------------------------------------------------
		include ("../M0/reload_super_user_parameters.php");

		$_SESSION['CONNECTED_USER_PW']				= $reloaded_SUPER_USER_PW;
		$_SESSION['CONNECTED_USER_STATUS']			= $reloaded_SUPER_USER_STATUS;
		$_SESSION['CONNECTED_USER_LEVEL']				= $reloaded_SUPER_USER_LEVEL;
		$_SESSION['CONNECTED_USER_T_MAX']				= $reloaded_SUPER_USER_T_MAX;
		$_SESSION['CONNECTED_USER_2FA_STATUS']		= $reloaded_SUPER_USER_2FA_STATUS;
		$_SESSION['CONNECTED_USER_2FA_PHONE']		= $reloaded_SUPER_USER_2FA_PHONE;
		$_SESSION['CONNECTED_USER_2FAS_STATUS']		= $reloaded_SUPER_USER_2FAS_STATUS;
		$_SESSION['CONNECTED_USER_2FAS_SECRET']		= $reloaded_SUPER_USER_2FAS_SECRET;

		//---------------------------------------------------------------------------------------------
		// recherche de l'indice du site en cours de sélection
		//---------------------------------------------------------------------------------------------
		$_SESSION['list_sites'] = $sites_from_AQCM05_SITES_LIST ;
		
		$FLAG_FOUND = false ;
		
		for ($i = 0; $i < sizeof($_SESSION['list_sites']); $i++) {
			
			if ( $_SESSION['SITE_ID'] == $_SESSION['list_sites'][$i] ) {
				
				$_SESSION['index_session'] 	= $i ;
				$FLAG_FOUND = true ;
				break;

			}
		
		}
		
		if ( $FLAG_FOUND ) {
			$_SESSION['SITE_NAME']				= $sites_from_AQCM05_SITES_NAMES[$_SESSION['index_session']] ;
			$_SESSION['SITE_STATUS']			= $sites_from_AQCM05_SITES_STATUS[$_SESSION['index_session']] ;
			$_SESSION['SITE_T_MAX']				= $sites_from_AQCM05_SITES_T_MAX[$_SESSION['index_session']] ;
			$_SESSION['SITE_NB_MAX']			= $sites_from_AQCM05_SITES_NB_MAX[$_SESSION['index_session']] ;
			$_SESSION['SITE_RX_WARNING_EN']	= $sites_from_AQCM05_SITES_RX_WARNING_EN[$_SESSION['index_session']] ;
			$_SESSION['SITE_LON']				= $sites_from_AQCM05_SITES_LON[$_SESSION['index_session']] ;
			$_SESSION['SITE_LAT']				= $sites_from_AQCM05_SITES_LAT[$_SESSION['index_session']] ;
			$_SESSION['SITE_IBM']				= $sites_from_AQCM05_SITES_IBM[$_SESSION['index_session']] ;
		}
		else {
			$_SESSION['SITE_ID'] 				= $sites_from_AQCM05_SITES_LIST[0] ;
			$_SESSION['SITE_NAME']				= $sites_from_AQCM05_SITES_NAMES[0] ;
			$_SESSION['SITE_STATUS']			= $sites_from_AQCM05_SITES_STATUS[0] ;
			$_SESSION['SITE_T_MAX']				= $sites_from_AQCM05_SITES_T_MAX[0] ;
			$_SESSION['SITE_NB_MAX']			= $sites_from_AQCM05_SITES_NB_MAX[0] ;
			$_SESSION['SITE_RX_WARNING_EN']	= $sites_from_AQCM05_SITES_RX_WARNING_EN[0] ;
			$_SESSION['SITE_LON']				= $sites_from_AQCM05_SITES_LON[0] ;
			$_SESSION['SITE_LAT']				= $sites_from_AQCM05_SITES_LAT[0] ;
			$_SESSION['SITE_IBM']				= $sites_from_AQCM05_SITES_IBM[0] ;
		}
	
	}
	elseif ( $_SESSION['user_type']	== "normal_user" ) {
		
		//---------------------------------------------------------------------------------------------
		// mise à jour des paramètres du super_user connecté depuis MySQL
		//---------------------------------------------------------------------------------------------
		include ("../M0/reload_normal_user_parameters.php");

		$_SESSION['CONNECTED_USER_PW']				= $reloaded_NORMAL_USER_PW;
		$_SESSION['CONNECTED_USER_STATUS']			= $reloaded_NORMAL_USER_STATUS;
		$_SESSION['CONNECTED_USER_LEVEL']				= $reloaded_NORMAL_USER_LEVEL;
		$_SESSION['CONNECTED_USER_T_MAX']				= $reloaded_NORMAL_USER_T_MAX;
		$_SESSION['CONNECTED_USER_2FA_STATUS']		= $reloaded_NORMAL_USER_2FA_STATUS;
		$_SESSION['CONNECTED_USER_2FA_PHONE']		= $reloaded_NORMAL_USER_2FA_PHONE;
		$_SESSION['CONNECTED_USER_2FAS_STATUS']		= $reloaded_NORMAL_USER_2FAS_STATUS;
		$_SESSION['CONNECTED_USER_2FAS_SECRET']		= $reloaded_NORMAL_USER_2FAS_SECRET;

		//-----------------------------------------------------------------------------------------
		$p_identifiant	= $_SESSION['login'] ;
		$p_password		= $_SESSION['password'] ;
		
		//-----------------------------------------------------------------------------------------
		include ("../M0/get_sites_of_1_user.php");

		if ( empty( $active_sites_id_strings ) ) {
			$active_sites_id_strings 				= ["00001_001"] ;
			$active_sites_names_strings 			= ["sans_nom"] ;
			$active_sites_status_strings			= ["OFF"] ;
			$active_sites_t_max_strings				= ["0"] ;
			$active_sites_nb_max_strings			= ["0"] ;
			$active_sites_rx_warning_en_strings	= ["OFF"] ;
			$active_sites_lon_strings 				= ["0.000000"] ;
			$active_sites_lat_strings 				= ["0.000000"] ;
			$active_sites_ibm_strings 				= ["OFF"] ;
		}
		
		if ( empty( $inactive_sites_id_strings ) ) {
			$inactive_sites_id_strings 				= ["00001_001"] ;
			$inactive_sites_names_strings 			= ["sans_nom"] ;
			$inactive_sites_status_strings			= ["OFF"] ;
			$inactive_sites_t_max_strings			= ["0"] ;
			$inactive_sites_nb_max_strings			= ["0"] ;
			$inactive_sites_rx_warning_en_strings	= ["OFF"] ;
			$inactive_sites_lon_strings 			= ["0.000000"] ;
			$inactive_sites_lat_strings 			= ["0.000000"] ;
			$inactive_sites_ibm_strings 			= ["OFF"] ;
		}

		//-----------------------------------------------------------------------------------------
		$FLAG_FOUND = false ;
		
		for ($i = 0; $i < sizeof($_SESSION['list_sites']); $i++) {
			
			if ( $_SESSION['SITE_ID'] == $_SESSION['list_sites'][$i] ) {
				
				$_SESSION['index_session'] 	= $i ;
				$FLAG_FOUND = true ;
				break;
				
			}
		
		}

		$_SESSION['status']			= $_SESSION['status_OK'][$_SESSION['index_session']] ;
		$_SESSION['level']			= $_SESSION['level_OK'][$_SESSION['index_session']] ;
		$_SESSION['t_max']			= $_SESSION['t_max_OK'][$_SESSION['index_session']] ;
		$_SESSION['login_level'] 	= $_SESSION['login'] . "&nbsp;&nbsp;&nbsp;(" . $_SESSION['level'] . ")" ;
		
		if ( $FLAG_FOUND ) {
			$_SESSION['SITE_NAME']				= $active_sites_names_strings[$_SESSION['index_session']] ;
			$_SESSION['SITE_STATUS']			= $active_sites_status_strings[$_SESSION['index_session']] ;
			$_SESSION['SITE_T_MAX']				= $active_sites_t_max_strings[$_SESSION['index_session']] ;
			$_SESSION['SITE_NB_MAX']			= $active_sites_nb_max_strings[$_SESSION['index_session']] ;
			$_SESSION['SITE_RX_WARNING_EN']	= $active_sites_rx_warning_en_strings[$_SESSION['index_session']] ;
			$_SESSION['SITE_LON']				= $active_sites_lon_strings[$_SESSION['index_session']] ;
			$_SESSION['SITE_LAT']				= $active_sites_lat_strings[$_SESSION['index_session']] ;
			$_SESSION['SITE_IBM']				= $active_sites_ibm_strings[$_SESSION['index_session']] ;
		}
		else {
			$_SESSION['SITE_ID']					= $active_sites_id_strings[0] ;
			$_SESSION['SITE_NAME']				= $active_sites_names_strings[0] ;
			$_SESSION['SITE_STATUS']			= $active_sites_status_strings[0] ;
			$_SESSION['SITE_T_MAX']				= $active_sites_t_max_strings[0] ;
			$_SESSION['SITE_NB_MAX']			= $active_sites_nb_max_strings[0] ;
			$_SESSION['SITE_RX_WARNING_EN']	= $active_sites_rx_warning_en_strings[0] ;
			$_SESSION['SITE_LON']				= $active_sites_lon_strings[0] ;
			$_SESSION['SITE_LAT']				= $active_sites_lat_strings[0] ;
			$_SESSION['SITE_IBM']				= $active_sites_ibm_strings[0] ;
		}
		
	}

	//---------------------------------------------------------------------------------------------
	// recensement des utilisateurs
	//---------------------------------------------------------------------------------------------
	include ("../M0/get_users_of_1_site.php");
	
	$users_of_1_site_id_strings 				= $aqcm_USER_ID ;
	$users_of_1_site_status_strings			= $aqcm_USER_STATUS ;
	$users_of_1_site_level_strings			= $aqcm_USER_LEVEL ;
	$users_of_1_site_t_max_strings			= $aqcm_USER_T_MAX ;
	$users_of_1_site_week_mail_strings		= $aqcm_USER_WEEK_MAIL ;
	$users_of_1_site_2fa_status_strings		= $aqcm_USER_2FA_STATUS ;
	$users_of_1_site_2fa_phone_strings		= $aqcm_USER_2FA_PHONE ;
	$users_of_1_site_rx_warning_en_strings	= $aqcm_USER_RX_WARNING_EN ;

	$_SESSION['list_users_of_1_site_id'] 	= $users_of_1_site_id_strings ;

	//---------------------------------------------------------------------------------------------
	// recherche de l'utilisateur actif
	//---------------------------------------------------------------------------------------------


	$FLAG_FOUND = false ;
	
	if ( sizeof($users_of_1_site_id_strings) == 0 ) {
		
		$FLAG_FOUND = false ;
		
	}
	else {
		
		for ($i = 0; $i < sizeof($users_of_1_site_id_strings); $i++) {
			
			//if ( $_SESSION['user_of_1_site_id'] == $users_of_1_site_id_strings[$i] ) {
			if ( $_SESSION['login'] == $users_of_1_site_id_strings[$i] ) {
				
				$_SESSION['user_of_1_site_index'] = $i ;
				$FLAG_FOUND = true ;
				break;
				
			}
		
		}
		
	}
	
	if ( $FLAG_FOUND ) {
		
		$_SESSION['user_of_1_site_id']					= $users_of_1_site_id_strings[$_SESSION['user_of_1_site_index']] ;
		$_SESSION['user_of_1_site_status']				= $users_of_1_site_status_strings[$_SESSION['user_of_1_site_index']] ;
		$_SESSION['user_of_1_site_level']				= $users_of_1_site_level_strings[$_SESSION['user_of_1_site_index']] ;
		$_SESSION['user_of_1_site_t_max']				= $users_of_1_site_t_max_strings[$_SESSION['user_of_1_site_index']] ;
		$_SESSION['user_of_1_site_week_mail']			= $users_of_1_site_week_mail_strings[$_SESSION['user_of_1_site_index']] ;
		$_SESSION['user_of_1_site_2fa_status']		= $users_of_1_site_2fa_status_strings[$_SESSION['user_of_1_site_index']] ;
		$_SESSION['user_of_1_site_2fa_phone']			= $users_of_1_site_2fa_phone_strings[$_SESSION['user_of_1_site_index']] ;
		$_SESSION['user_of_1_site_rx_warning_en']	= $users_of_1_site_rx_warning_en_strings[$_SESSION['user_of_1_site_index']] ;
		
	}
	else {
		
		$_SESSION['user_of_1_site_id']					= $users_of_1_site_id_strings[0] ;
		$_SESSION['user_of_1_site_status']				= $users_of_1_site_status_strings[0] ;
		$_SESSION['user_of_1_site_level']				= $users_of_1_site_level_strings[0] ;
		$_SESSION['user_of_1_site_t_max']				= $users_of_1_site_t_max_strings[0] ;
		$_SESSION['user_of_1_site_week_mail']			= $users_of_1_site_week_mail_strings[0] ;
		$_SESSION['user_of_1_site_2fa_status']		= $users_of_1_site_2fa_status_strings[0] ;
		$_SESSION['user_of_1_site_2fa_phone']			= $users_of_1_site_2fa_phone_strings[0] ;
		$_SESSION['user_of_1_site_rx_warning_en']	= $users_of_1_site_rx_warning_en_strings[0] ;
		
	}

	//---------------------------------------------------------------------------------------------
	// recherche de l'utilisateur normal cible
	//---------------------------------------------------------------------------------------------
	$_SESSION['target_user_index']	= 0 ;
	
	if ( ! isset($_SESSION['target_user_id']) ) {
		$_SESSION['target_user_id'] = "none" ;
	}
	$FLAG_FOUND_TARGET = false ;

	if ( sizeof($users_of_1_site_id_strings) == 0 ) {
		
		$FLAG_FOUND_TARGET = false ;
		
	}
	else {
		
		for ($i = 0; $i < sizeof($users_of_1_site_id_strings); $i++) {
			
			if ( $_SESSION['target_user_id'] == $users_of_1_site_id_strings[$i] ) {
				
				$_SESSION['target_user_index'] = $i ;
				$FLAG_FOUND_TARGET = true ;
				break;
				
			}
		
		}
		
	}
	
	if ( $FLAG_FOUND_TARGET ) {
		$_SESSION['target_user_id']				= $users_of_1_site_id_strings[$_SESSION['target_user_index']] ;
		$_SESSION['target_user_status']			= $users_of_1_site_status_strings[$_SESSION['target_user_index']] ;
		$_SESSION['target_user_level']			= $users_of_1_site_level_strings[$_SESSION['target_user_index']] ;
		$_SESSION['target_user_t_max']			= $users_of_1_site_t_max_strings[$_SESSION['target_user_index']] ;
		$_SESSION['target_user_week_mail']		= $users_of_1_site_week_mail_strings[$_SESSION['target_user_index']] ;
		$_SESSION['target_user_2fa_status']		= $users_of_1_site_2fa_status_strings[$_SESSION['target_user_index']] ;
		$_SESSION['target_user_2fa_phone']		= $users_of_1_site_2fa_phone_strings[$_SESSION['target_user_index']] ;
		$_SESSION['target_user_rx_warning_en']	= $users_of_1_site_rx_warning_en_strings[$_SESSION['target_user_index']] ;
	}
	else {
		$_SESSION['target_user_id']				= "none" ;
		$_SESSION['target_user_status']			= "1";
		$_SESSION['target_user_level']			= "";
		$_SESSION['target_user_t_max']			= 0;
		$_SESSION['target_user_week_mail']		= "";
		$_SESSION['target_user_2fa_status']		= "";
		$_SESSION['target_user_2fa_phone']		= "+33123456789";
		$_SESSION['target_user_rx_warning_en']	= "";
	}

	//---------------------------------------------------------------------------------------------
	// recensement des administrateurs cibles
	//---------------------------------------------------------------------------------------------
	include ("../M0/get_super_users.php");
	
	$admins_id_strings 				= $aqcm_SUPER_USER_ID ;
	$admins_pw_strings 				= $aqcm_SUPER_USER_PW ;
	$admins_status_strings			= $aqcm_SUPER_USER_STATUS ;
	$admins_level_strings			= $aqcm_SUPER_USER_LEVEL ;
	$admins_t_max_strings			= $aqcm_SUPER_USER_T_MAX ;
	$admins_2fa_status_strings		= $aqcm_SUPER_USER_2FA_STATUS ;
	$admins_2fa_phone_strings		= $aqcm_SUPER_USER_2FA_PHONE ;
	$admins_2fas_status_strings		= $aqcm_SUPER_USER_2FAS_STATUS ;
	$admins_2fas_secret_strings		= $aqcm_SUPER_USER_2FAS_SECRET ;

	$_SESSION['list_admins'] 		= $admins_id_strings ;
	$_SESSION['list_admins_level']	= $admins_level_strings ;

	//---------------------------------------------------------------------------------------------
	// recherche de l'administrateur cible
	//---------------------------------------------------------------------------------------------
	$_SESSION['target_admin_index']	= 0 ;
	
	if ( ! isset($_SESSION['target_admin_id']) ) {
		$_SESSION['target_admin_id'] = "none" ;
	}
	$FLAG_FOUND_TARGET_ADMIN = false ;

	if ( sizeof($admins_id_strings) == 0 ) {
		
		$FLAG_FOUND_TARGET_ADMIN = false ;
		
	}
	else {
		
		for ($i = 0; $i < sizeof($admins_id_strings); $i++) {
			
			if ( $_SESSION['target_admin_id'] == $admins_id_strings[$i] ) {
				
				$_SESSION['target_admin_index'] = $i ;
				$FLAG_FOUND_TARGET_ADMIN = true ;
				break;
				
			}
		
		}
		
	}
	
	if ( $FLAG_FOUND_TARGET_ADMIN ) {
		$_SESSION['target_admin_id']			= $admins_id_strings[$_SESSION['target_admin_index']] ;
		$_SESSION['target_admin_pw']			= $admins_pw_strings[$_SESSION['target_admin_index']] ;
		$_SESSION['target_admin_status']		= $admins_status_strings[$_SESSION['target_admin_index']] ;
		$_SESSION['target_admin_level']		= $admins_level_strings[$_SESSION['target_admin_index']] ;
		$_SESSION['target_admin_t_max']		= $admins_t_max_strings[$_SESSION['target_admin_index']] ;
		$_SESSION['target_admin_2fa_status']	= $admins_2fa_status_strings[$_SESSION['target_admin_index']] ;
		$_SESSION['target_admin_2fa_phone']	= $admins_2fa_phone_strings[$_SESSION['target_admin_index']] ;
		$_SESSION['target_admin_2fas_status']	= $admins_2fas_status_strings[$_SESSION['target_admin_index']] ;
		$_SESSION['target_admin_2fas_secret']	= $admins_2fas_secret_strings[$_SESSION['target_admin_index']] ;
	}
	else {
		$_SESSION['target_admin_id']			= "none" ;
		$_SESSION['target_admin_pw']			= "" ;
		$_SESSION['target_admin_status']		= "" ;
		$_SESSION['target_admin_level']		= "90" ;
		$_SESSION['target_admin_t_max']		= 0 ;
		$_SESSION['target_admin_2fa_status']	= "" ;
		$_SESSION['target_admin_2fa_phone']	= "+33123456789" ;
		$_SESSION['target_admin_2fas_status']	= "" ;
		$_SESSION['target_admin_2fas_secret']	= "" ;
	}
	//echo("S_SESSION['target_admin_id'] = ");echo($_SESSION['target_admin_id']);echo("</br>");
	//echo("S_SESSION['target_admin_level'] = ");echo($_SESSION['target_admin_level']);echo("</br>");

	//-------------------------------------------------------------------------
	if ( $FLAG_DISPLAY_SESSION ) {
		
		echo( "INDEX_SESSION = " 		. $_SESSION['index_session'] ) ; 		echo("<br>");
		echo( "LOGIN = " 				. $_SESSION['login'] ) ; 				echo("<br>");
		echo( "PASSWORD = " 				. $_SESSION['password'] ) ; 			echo("<br>");
		echo( "USER_TYPE = " 			. $_SESSION['user_type'] ) ; 			echo("<br>");
		echo( "ADMIN_2FA = " 			. $_SESSION['admin_2FA'] ) ; 			echo("<br>");
		echo( "CODE_2FA = " 				. $_SESSION['code_2FA'] ) ; 			echo("<br>");
		echo( "CODE_2FA_HASHED = " 		. $_SESSION['code_2FA_hashed'] ) ; 	echo("<br>");
		echo( "CODE_2FA_T_LIMIT = " 	. $_SESSION['code_2FA_t_limit'] ) ; 	echo("<br>");
		echo( "CODE_2FA_MSG = " 		. $_SESSION['code_2FA_msg'] ) ; 		echo("<br>");
		echo( "2FA_CODE_ERREUR = "		. $_SESSION['2FA_code_erreur'] ) ; 	echo("<br>");

		echo( "TABLE_USERS = " 			. $_SESSION['table_users'] ) ; 		echo("<br>");
		
		echo( "SITE_ID = " 				. $_SESSION['SITE_ID'] ) ; 	echo("<br>");
		echo( "SITE_NAME = " 			. $_SESSION['SITE_NAME'] ) ; 	echo("<br>");
		echo( "SITE_STATUS = " 			. $_SESSION['SITE_STATUS'] ) ; echo("<br>");
		echo( "SITE_T_MAX = " 			. $_SESSION['SITE_T_MAX'] ) ; echo("<br>");
		echo( "SITE_NB_MAX = " 			. $_SESSION['SITE_NB_MAX'] ) ; 	echo("<br>");
		echo( "SITE_LON = " 				. $_SESSION['SITE_LON'] ) ; 	echo("<br>");
		echo( "SITE_LAT = " 				. $_SESSION['SITE_LAT'] ) ; 	echo("<br>");
		echo( "SITE_IBM = " 				. $_SESSION['SITE_IBM'] ) ; 	echo("<br>");
		
		echo( "BASE_USERS = " 			. $_SESSION['base_users'] ) ; echo("<br>");
		echo( "USER_STATUS = " 			. $_SESSION['status'] ) ; 		echo("<br>");
		echo( "USER_LEVEL = " 			. $_SESSION['level'] ) ; 		echo("<br>");
		echo( "USER_T_MAX = " 			. $_SESSION['t_max'] ) ; 		echo("<br>");
		echo( "USER_LOGIN_LEVEL = " 	. $_SESSION['login_level'] ) ; 	echo("<br>");
		
		echo( "AQCM_BAT = " 				. $_SESSION['aqcm_BAT'] ) ; 	echo("<br>");
		echo( "AQCM_NIVEAU = " 			. $_SESSION['aqcm_NIVEAU'] ) ; 	echo("<br>");

		echo("<br>");

		echo( "USER_OF_1_SITE_INDEX = " 		. $_SESSION['user_of_1_site_index'] ) ; 		echo("<br>");
		echo( "USER_OF_1_SITE_ID = " 			. $_SESSION['user_of_1_site_id'] ) ; 			echo("<br>");
		echo( "USER_OF_1_SITE_STATUS = " 		. $_SESSION['user_of_1_site_status'] ) ; 		echo("<br>");
		echo( "USER_OF_1_SITE_LEVEL = " 		. $_SESSION['user_of_1_site_level'] ) ; 		echo("<br>");
		echo( "USER_OF_1_SITE_T_MAX = " 		. $_SESSION['user_of_1_site_t_max'] ) ; 		echo("<br>");
		echo( "USER_OF_1_SITE_WEEK_MAIL = "	. $_SESSION['user_of_1_site_week_mail'] ) ;		echo("<br>");
		echo( "USER_OF_1_SITE_2FA_STATUS = "	. $_SESSION['user_of_1_site_2fa_status'] ) ;	echo("<br>");
		echo( "USER_OF_1_SITE_2FA_PHONE = "	. $_SESSION['user_of_1_site_2fa_phone'] ) ;		echo("<br>");

		echo("<br>");
		
		print_r( "LIST_SITES " ) ;	echo(" ; ");print_r( $_SESSION['list_sites'] ) ;	echo("<br>");
		print_r( "STATUS_OK " ) ;	echo(" ; ");print_r( $_SESSION['status_OK'] ) ;	echo("<br>");
		print_r( "LEVEL_OK " ) ;	echo(" ; ");print_r( $_SESSION['level_OK'] ) ;		echo("<br>");
		print_r( "T_MAX_OK " ) ;	echo(" ; ");print_r( $_SESSION['t_max_OK'] ) ;		echo("<br>");

		print_r( "LIST_INACTIVE_SITES " ) ;	echo(" ; ");print_r( $_SESSION['list_inactive_sites'] ) ;		echo("<br>");
		
		echo( "aqcm_ANNEE = " 				. $_SESSION['aqcm_ANNEE'] ) ; 				echo("<br>");
		echo( "aqcm_MOIS = " 				. $_SESSION['aqcm_MOIS'] ) ; 				echo("<br>");
		echo( "aqcm_JOUR = " 				. $_SESSION['aqcm_JOUR'] ) ; 				echo("<br>");
		echo( "aqcm_SCH_STAT = " 			. $_SESSION['aqcm_SCH_STAT'] ) ; 				echo("<br>");

	}

	//-------------------------------------------------------------------------
	// debug temporaire
	//-------------------------------------------------------------------------
	/*	
		echo( "SITE_NAME = " 			. $_SESSION['SITE_NAME'] ) ; 	echo("<br>");
		echo( "SITE_STATUS = " 			. $_SESSION['SITE_STATUS'] ) ; echo("<br>");
		echo( "SITE_T_MAX = " 			. $_SESSION['SITE_T_MAX'] ) ; echo("<br>");
		echo( "SITE_NB_MAX = " 			. $_SESSION['SITE_NB_MAX'] ) ; 	echo("<br>");
		echo( "SITE_LON = " 				. $_SESSION['SITE_LON'] ) ; 	echo("<br>");
		echo( "SITE_LAT = " 				. $_SESSION['SITE_LAT'] ) ; 	echo("<br>");
		echo( "SONDE_T_MAX = " 			. $_SESSION['SONDE_T_MAX'] ) ; 	echo("<br>");
		
			echo( "aqcm_PREFIXE = " 		. $_SESSION['aqcm_PREFIXE'] ) ; 	echo("<br>");
			echo( "SITE_ID = " 				. $_SESSION['SITE_ID'] ) ; 	echo("<br>");
			echo( "AQCM_BAT = " 				. $_SESSION['aqcm_BAT'] ) ; 	echo("<br>");
			echo( "AQCM_NIVEAU = " 			. $_SESSION['aqcm_NIVEAU'] ) ; 	echo("<br>");
			echo( "SONDE_MAC = " 			. $_SESSION['SONDE_MAC'] ) ; 	echo("<br>");
			echo( "SONDE_NAME = " 			. $_SESSION['SONDE_NAME'] ) ; 	echo("<br>");
		
	*/
	/*
		echo( "S_SESSION['CONNECTED_USER_ID'] = "			. $_SESSION['CONNECTED_USER_ID'] ) ; 	echo("<br>");
		echo( "S_SESSION['CONNECTED_USER_PW'] = "			. $_SESSION['CONNECTED_USER_PW'] ) ; 	echo("<br>");
		echo( "S_SESSION['CONNECTED_USER_STATUS'] = "		. $_SESSION['CONNECTED_USER_STATUS'] ) ; 	echo("<br>");
		echo( "S_SESSION['CONNECTED_USER_LEVEL'] = "			. $_SESSION['CONNECTED_USER_LEVEL'] ) ; 	echo("<br>");
		echo( "S_SESSION['CONNECTED_USER_T_MAX'] = "			. $_SESSION['CONNECTED_USER_T_MAX'] ) ; 	echo("<br>");
		echo( "S_SESSION['CONNECTED_USER_2FA_STATUS'] = "	. $_SESSION['CONNECTED_USER_2FA_STATUS'] ) ; 	echo("<br>");
		echo( "S_SESSION['CONNECTED_USER_2FA_PHONE'] = "	. $_SESSION['CONNECTED_USER_2FA_PHONE'] ) ; 	echo("<br>");
		echo( "S_SESSION['CONNECTED_USER_2FAS_STATUS'] = "	. $_SESSION['CONNECTED_USER_2FAS_STATUS'] ) ; 	echo("<br>");
		echo( "S_SESSION['CONNECTED_USER_2FAS_SECRET'] = "	. $_SESSION['CONNECTED_USER_2FAS_SECRET'] ) ; 	echo("<br>");
	*/
	/*
		echo( "S_SESSION['target_admin_id'] = "			. $_SESSION['target_admin_id'] ) ; 	echo("<br>");
		echo( "S_SESSION['target_admin_pw'] = "			. $_SESSION['target_admin_pw'] ) ; 	echo("<br>");
		echo( "S_SESSION['target_admin_status'] = "		. $_SESSION['target_admin_status'] ) ; 	echo("<br>");
		echo( "S_SESSION['target_admin_level'] = "			. $_SESSION['target_admin_level'] ) ; 	echo("<br>");
		echo( "S_SESSION['target_admin_t_max'] = "			. $_SESSION['target_admin_t_max'] ) ; 	echo("<br>");
		echo( "S_SESSION['target_admin_2fa_status'] = "	. $_SESSION['target_admin_2fa_status'] ) ; 	echo("<br>");
		echo( "S_SESSION['target_admin_2fa_phone'] = "	. $_SESSION['target_admin_2fa_phone'] ) ; 	echo("<br>");
		echo( "S_SESSION['target_admin_2fas_status'] = "	. $_SESSION['target_admin_2fas_status'] ) ; 	echo("<br>");
		echo( "S_SESSION['target_admin_2fas_secret'] = "	. $_SESSION['target_admin_2fas_secret'] ) ; 	echo("<br>");
	*/
	//---------------------------------------------------------------------------------------------
	if ( $FLAG_DISPLAY_DEBUG ) {
		echo( "AQCM_BAT = " 				. $_SESSION['aqcm_BAT'] ) ; 	echo("<br>");
		echo( "AQCM_NIVEAU = " 			. $_SESSION['aqcm_NIVEAU'] ) ; 	echo("<br>");
		echo("</br>");
	}

	//-------------------------------------------------------------------------
	$couleurs = ["#00A000", "#00FF00", "#FFFF00", "#FF8000", "#FF0000", "#FF00FF", "#00FFFF"] ;
	
	include('../M0/AQCM_get_seuils_CO2.php');
	$CO2_TRIG_VALUE[0] = intval($aqcm_CO2_TRIG_0) ;
	$CO2_TRIG_VALUE[1] = intval($aqcm_CO2_TRIG_1) ;
	$CO2_TRIG_VALUE[2] = intval($aqcm_CO2_TRIG_2) ;
	$CO2_TRIG_VALUE[3] = intval($aqcm_CO2_TRIG_3) ;
	$CO2_TRIG_VALUE[4] = intval($aqcm_CO2_TRIG_4) ;
	$CO2_TRIG_VALUE[5] = intval($aqcm_CO2_TRIG_5) ;

	//-------------------------------------------------------------------------

?>
