diff --git a/site/add.php b/site/add.php index 4367c6c..f664750 100644 --- a/site/add.php +++ b/site/add.php @@ -49,12 +49,35 @@ session_start(); $temps = getTime($_POST['type']); file_put_contents('upload/temps.txt', $temps); - exec("super cmd.sh"); + $retour = array(); + $statut; + exec("super cmd.sh", $retour, $statut); + + if($statut == 0) + { + $message = "Le capteur a bien été ajouté !"; + $color = "alert-success"; + } + else + { + $ansible = "Code retour : ".$statut."
"; + $message = "Echec lors de l'ajout. Vérifiez vos informations !"; + $color = "alert-danger"; + } + + $size = count($retour); + for($i = 0; $i<$size; $i++) + { + $ansible = $ansible.$retour[$i]."
"; + } + ?> -