<?php 
session_start();

require_once(dirname(__DIR__, 2) . '/config.php');
require_once(BASE_PATH . '/db/idl_connect.php');

if(isset($_SESSION['user_droits'])) {
	$hcheck = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT h_inscription2, h_inscription3 FROM ".$prefix."_freq WHERE freq_id = '".$_REQUEST['freq']."'"));
	$h_sortie = date('Ymd').'T'.date('His');

	if(strlen($hcheck['h_inscription3'])==15) { $hs = 'h_sortie_3'; }
	else if(strlen($hcheck['h_inscription2'])==15) { $hs = 'h_sortie_2'; }
	else { $hs = 'h_sortie'; }

	mysqli_query($bdd,"UPDATE ".$prefix."_freq SET cas = '".$_REQUEST['cas']."', ".$hs." = '".$h_sortie."' WHERE freq_id = '".$_REQUEST['freq']."'");
}
mysqli_close($bdd);
?>