File "ajax_update_statut.php"

Full Path: /home/analogde/www/MassageProd/ajax_update_statut.php
File size: 2.88 KB
MIME-type: text/x-php
Charset: utf-8

<?php

	//ajax_update_statut.php
	session_start ();
	include('database.php');	
	include('fonctions.php');	
	include('generation_timing.php');

	//error_reporting(0);
	
	//$_SESSION['table_gestion'] = "gestion_v6"; 
	//$_SESSION['mode_debug'] = "yes"; 	
		
	//DB_connexion(); 
	
	//$indice = $_POST['val'];
	$client = $_POST['client'];
	$jour = $_POST['jour'];
	$inscription = $_POST['inscription'];
	$horaire = $_POST['horaire'];
	
	//$seance = strval($_POST['seance']);
	
	//$tarif = $_POST['tarif'];
	
	//VOORWINDEN Cor*10-01-2023*06-01-2023 14:19:40*2*8
	
	//$client = "VOORWINDEN Cor";
	//$jour = "10-01-2023";
	//$inscription ="06-01-2023 14:19:40";
	
	
	
	
	
	//$connexion = "connexion";
	
	//$sql = "UPDATE " .$_SESSION['table_gestion'] ." SET connexion = '$connexion' WHERE jour = '$jour' AND date_inscription = '$inscription' AND client = '$client' AND seance = '$seance' ";

	//echo $sql;
	
	//enregistre($client, $jour, $inscription , $seance , "connexion_cse");
	
	//ALTER TABLE utilisateur ADD CSE VARCHAR(255)  
	// prévoir une valeur par défaut
	// ALTER TABLE Stock ALTER COLUMN qte SET DEFAULT 0;
	
	//Alter table Personnes ADD(Pays Varchar(10) Default 'France');
	//ALTER TABLE maTable ADD maNouvelleColonne VARCHAR(200) DEFAULT 'valeurParDefaut';
	
	//Alter table gestion_v5 ADD(connexion Varchar(255) Default 'no');
	
	$connexion_cse = "connexion";
	
	$double_seance = strpos($horaire, "-"); // -
		   
	$detection = "";	   
		   
	if ($double_seance == true)
	{
		$tab_double = explode('-', $horaire); // -
		$seance1 = $tab_double[0];
		$seance2 = $tab_double[1];
		enregistre($client, $jour, $inscription , $seance1 , $connexion_cse );
		enregistre($client, $jour, $inscription , $seance2 , $connexion_cse );
		//if($debug)
		//{
		//	echo "Double ---> " .$seance1 ." & " .$seance2 ."<br>";	
		//	echo "Datas enregistrées";
		//	echo '<br><br>';
		//}
		
		$detection = "double";
		
	}	
	
	else
	{
		enregistre($client, $jour, $inscription , $horaire , $connexion_cse);
		$detection = "simple";
		//if($debug)
		//{
		//	echo " Unique ---> " .$seance_unique ."<br>";
		//	echo "Datas enregistrées";
		//	echo '<br><br>';
		//}	
		
	}	
	
//	echo "TRACE "  .$detection ." " . $indice ." " .$client ." " .$jour ." " .$inscription ." " .$seance ." " .$tarif;

	//echo "TRACE " .$detection ." ".$horaire ." " .$tarif;

	
function enregistre($client, $jour, $inscription , $seance , $connexion_cse)
{
		$connexion = DB();  
		
		$sql = "UPDATE " .$_SESSION['table_gestion'] ." SET connexion = '$connexion_cse' WHERE jour = '$jour' AND date_inscription = '$inscription' AND client = '$client' AND seance = '$seance' ";
			
		mysqli_query($connexion, "SET NAMES 'utf8'");	
		$result = mysqli_query($connexion, $sql );
				
		if(!$result)	
		{	
			die('Impossible d\'exécuter la requête :' . mysql_error());	
		}
}	
?>