Commit fe0eb67b18af623af53e7623553ac376d6cbe6c0
1 parent
ec9f9ab0
MAJ site
Showing
2 changed files
with
18 additions
and
19 deletions
Show diff stats
site/add.php
... | ... | @@ -22,7 +22,24 @@ session_start(); |
22 | 22 | <?php |
23 | 23 | if(add($_POST['nom'], $_POST['type'], $_POST['raspberry'], $_POST['numero'], $_POST['unite'], $_POST['version'])) |
24 | 24 | { |
25 | - include("ansibleSensor.php"); | |
25 | + $arduino_simple = "[Arduino_init]\r\n"; | |
26 | + $arduino_spi = "[Arduino_spi_init]\r\n"; | |
27 | + $nucleo = "[Nucleo_init]\r\n"; | |
28 | + | |
29 | + if($_POST['version'] == 0) | |
30 | + { | |
31 | + $ini = $arduino_simple; | |
32 | + } | |
33 | + elseif($_POST['version'] == 1) | |
34 | + { | |
35 | + $ini = $arduino_spi; | |
36 | + } | |
37 | + elseif($_POST['version'] == 2) | |
38 | + { | |
39 | + $ini = $nucleo; | |
40 | + } | |
41 | + $ini = $ini.$_POST['raspberry']." capteur=".$_POST['numero']."\n"; | |
42 | + file_put_contents('upload/inventaire.ini', $ini); | |
26 | 43 | ?> |
27 | 44 | <div class="alert alert-success" role="alert"> |
28 | 45 | Le capteur a bien été ajouté ! | ... | ... |
site/ansibleSensor.php deleted
... | ... | @@ -1,18 +0,0 @@ |
1 | -$arduino_simple = "[Arduino_init]\r\n"; | |
2 | -$arduino_spi = "[Arduino_spi_init]\r\n"; | |
3 | -$nucleo = "[Nucleo_init]\r\n"; | |
4 | - | |
5 | -if($_POST['version'] == 0) | |
6 | -{ | |
7 | - $ini = $arduino_simple; | |
8 | -} | |
9 | -elseif($_POST['version'] == 1) | |
10 | -{ | |
11 | - $ini = $arduino_spi; | |
12 | -} | |
13 | -elseif($_POST['version'] == 2) | |
14 | -{ | |
15 | - $ini = $nucleo | |
16 | -} | |
17 | -$ini = $ini.$_POST['raspberry']." capteur=".$_POST['numero']."\n"; | |
18 | -file_put_contents('upload/inventaire.ini', $ini); | |
19 | 0 | \ No newline at end of file |