Commit b03dafc962664383ce6973fd2c606f5e9c499d31
1 parent
f81fff10
MAJ
Showing
1 changed file
with
27 additions
and
4 deletions
Show diff stats
site/add.php
... | ... | @@ -49,12 +49,35 @@ session_start(); |
49 | 49 | $temps = getTime($_POST['type']); |
50 | 50 | file_put_contents('upload/temps.txt', $temps); |
51 | 51 | |
52 | - exec("super cmd.sh"); | |
52 | + $retour = array(); | |
53 | + $statut; | |
54 | + exec("super cmd.sh", $retour, $statut); | |
55 | + | |
56 | + if($statut == 0) | |
57 | + { | |
58 | + $message = "Le capteur a bien été ajouté !"; | |
59 | + $color = "alert-success"; | |
60 | + } | |
61 | + else | |
62 | + { | |
63 | + $ansible = "Code retour : ".$statut."<br/>"; | |
64 | + $message = "Echec lors de l'ajout. Vérifiez vos informations !"; | |
65 | + $color = "alert-danger"; | |
66 | + } | |
67 | + | |
68 | + $size = count($retour); | |
69 | + for($i = 0; $i<$size; $i++) | |
70 | + { | |
71 | + $ansible = $ansible.$retour[$i]."<br/>"; | |
72 | + } | |
73 | + | |
53 | 74 | ?> |
54 | - <div class="alert alert-success" role="alert"> | |
55 | - Le capteur a bien été ajouté ! | |
75 | + <div class="alert <?php echo $color;?>" role="alert"> | |
76 | + <?php echo $message;?> | |
77 | + </div> | |
78 | + <div class="alert alert-secondary" role="alert"> | |
79 | + <?php echo $ansible;?> | |
56 | 80 | </div> |
57 | - <meta http-equiv="Refresh" content="3;url=accueil.php" /> | |
58 | 81 | <?php |
59 | 82 | } |
60 | 83 | else | ... | ... |