705b4085
root
MAJ Site
|
1
2
3
4
5
6
7
8
9
|
<?php
session_start();
require("accesBase.php");
$err = false;
if(isset($_POST['sensor']))
{
$ini = "";
$arduino_simple = "[Arduino]\r\n";
|
c00f0c15
root
MAJ
|
10
|
$arduino_spi = "[Arduino]\r\n";
|
705b4085
root
MAJ Site
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
$nucleo = "[Nucleo]\r\n";
$a_simple = false;
$a_spi = false;
$n = false;
foreach($_POST['sensor'] as $sensor => $value)
{
$version = -1;
$val = explode(":", $value);
if(count($types)<>0 && !in_array($val[2], $types)) {$err = true;}
else {$types[] = $val[2];}
$version = getSensorVersion($val[0], $val[1]);
if($version == 0)
{
$a_simple = true;
|
1496fa4f
Guillaume
MAJ site
|
29
|
$arduino_simple = $arduino_simple.$val[0]." capteur=".$val[1]."-".$version."\n";
|
705b4085
root
MAJ Site
|
30
31
32
33
|
}
elseif($version == 1)
{
$a_spi = true;
|
1496fa4f
Guillaume
MAJ site
|
34
|
$arduino_spi = $arduino_spi.$val[0]." capteur=".$val[1]."-".$version."\n";
|
705b4085
root
MAJ Site
|
35
36
37
38
|
}
elseif($version == 2)
{
$n = true;
|
1496fa4f
Guillaume
MAJ site
|
39
|
$nucleo = $nucleo.$val[0]." capteur=".$val[1]."-".$version."\n";
|
705b4085
root
MAJ Site
|
40
41
42
43
44
45
46
47
48
|
}
}
if($a_simple) {$ini = $ini.$arduino_simple."\n";}
if($a_spi) {$ini = $ini.$arduino_spi."\n";}
if($n) {$ini = $ini.$nucleo."\n";}
if(!$err)
{
|
0163ddbb
grouille
Test de lancement...
|
49
|
file_put_contents('upload/inventaire.ini', $ini);
|
2a801f51
grouille
Test de lancement...
|
50
51
52
53
54
|
$upload = load($_FILES['fichier']['tmp_name'], $_FILES['fichier']['name']);
if($upload)
{
$message = "Upload du fichier réussi !";
$color = "alert-success";
|
d3e704f6
grouille
Test
|
55
|
exec("super cmd.sh");
|
2a801f51
grouille
Test de lancement...
|
56
57
58
59
60
|
}
else
{
$message = "Erreur lors du transfert du fichier...";
$color = "alert-danger";
|
705b4085
root
MAJ Site
|
61
|
}
|
705b4085
root
MAJ Site
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
}
else
{
$message = "Veuillez choisir des capteurs de même type !";
$color = "alert-danger";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<?php include("head.php"); ?>
</head>
<body>
<?php
include("header.php");
include("reponse.php");
if(!$err) {include("tableau.php");}
|
4cc1c9fb
Guillaume
MAJ site
|
83
|
else {include("capteurs.php");}
|
705b4085
root
MAJ Site
|
84
85
86
|
?>
</body>
</html>
|