<?php
include("include/data.php");
Init_boutique();
global $base, $MySQL_Host, $MySQL_User, $MySQL_Passw, $myart, $A_NumArt,$i, $result, $NbLigne, 
$mygroupeart, $mysousgroupeart, $semaine, $limitesuivante, $limiteprecedente, $limite, $total, 
$page, $Nom_Client, $NumAbat;
// entete de la page


echo "<center><br>";

/*
http://192.168.1.200/horius/modif_plu_check.php?Num_entre=1
num_ordre=2
nom_plu=RUMSTECK
nom_plu_compl=de+vache
num_cate_plu=1
num_type_plu=1
attribu_plu=
dlc_plu=15
ok=Valider
*/

if (!isset($_GET['num_ordre'])) { 
		// Transmis en POST
		$num_ordre=$_POST['num_ordre'];
		if (isset($_POST['Num_entre'])) { $Num_entre=$_POST['Num_entre']; }  else {$Num_entre=''; }
		if (isset($_POST['nom_plu'])) { $nom_plu=$_POST['nom_plu']; } else {$nom_plu=''; }
		if (isset($_POST['nom_plu_compl'])) { $nom_plu_compl=$_POST['nom_plu_compl']; } else {$nom_plu_compl=''; }
		if (isset($_POST['num_cate_plu'])) { $num_cate_plu=$_POST['num_cate_plu']; } else {$num_cate_plu=''; }
		if (isset($_POST['num_type_plu'])) { $num_type_plu=$_POST['num_type_plu']; } else {$num_type_plu=''; }
		if (isset($_POST['attribu_plu'])) { $attribu_plu=$_POST['attribu_plu']; } else {$attribu_plu=''; }
		if (isset($_POST['dlc_plu'])) { $dlc_plu=$_POST['dlc_plu']; } else {$dlc_plu=''; }
		
		$valForm="POST" ;
} else {
		// Transmis en GET
		$num_ordre=$_GET['num_ordre'];
		if (isset($_GET['Num_entre'])) { $Num_entre=$_GET['Num_entre']; }  else {$Num_entre=''; }
		if (isset($_GET['nom_plu'])) { $nom_plu=$_GET['nom_plu']; } else {$nom_plu=''; }
		if (isset($_GET['nom_plu_compl'])) { $nom_plu_compl=$_GET['nom_plu_compl']; } else {$nom_plu_compl=''; }
		if (isset($_GET['num_cate_plu'])) { $num_cate_plu=$_GET['num_cate_plu']; } else {$num_cate_plu=''; }
		if (isset($_GET['num_type_plu'])) { $num_type_plu=$_GET['num_type_plu']; } else {$num_type_plu=''; }
		if (isset($_GET['attribu_plu'])) { $attribu_plu=$_GET['attribu_plu']; } else {$attribu_plu=''; }
		if (isset($_GET['dlc_plu'])) { $dlc_plu=$_GET['dlc_plu']; } else {$dlc_plu=''; }
				
		$valForm="GET" ;
}

$timestamp = date('Y-m-d G:i:s');

$nom_plu_compl = htmlentities($nom_plu_compl, ENT_QUOTES);
$nom_plu = htmlentities($nom_plu, ENT_QUOTES);

$date = date("d-m-Y");

Echo "<center><font color='red'>Enregistrement</font></center>";

echo "<br>";
echo "num_ligne : ".$Num_entre." <br>";
echo "Nom Plu: ".$nom_plu." <br>";
echo "Nom Plu Complement: ".$nom_plu_compl."<br>";
echo "Num_Categorie PLu : ".$Num_CatPlu." <br>";
echo "Num_Type PLu : ".$Num_TypePlu." <br>";
echo "Atribu plu ".$attribu_plu." <br>";
echo "Prix Kg : ".$Prix_Kg_Plu." <br>";
echo "DLC : ".$dlc_plu." <br>";
echo "timestamp : ".$timestamp." <br>";


$sql = "UPDATE plu SET 
`PLU` = '$nom_plu', 
`Plu_complement` = '$nom_plu_compl', 
`Num_CatPlu` = '$num_cate_plu', 
`Num_TypePlu` = '$num_type_plu', 
`attribu_plu` = '$attribu_plu', 
`dlc_plu` = '$dlc_plu', 
`Timestamp` = '$timestamp'
 WHERE `Num_PLU` = '$Num_entre' AND `IdNumClient`=$IdNumClient";

echo "requet : ".$sql." <br>";

$res = mysqli_query($link, $sql);

echo "resultat requet : ".$res." <br>";


$refere = $_SERVER['HTTP_REFERER'] ;
Header("Location:  $refere") ;

?>