Commit 68948dda170d63c4364ab9b15219814ff72bcbab
1 parent
1496fa4f
MAJ site
Showing
2 changed files
with
2 additions
and
142 deletions
Show diff stats
site/envoiFichiers.php deleted
@@ -1,140 +0,0 @@ | @@ -1,140 +0,0 @@ | ||
1 | -<?php | ||
2 | -session_start(); | ||
3 | -$error = false; | ||
4 | -/*$error2 = false; | ||
5 | - | ||
6 | -if ( isset($_POST['sensor']) && count($_POST['sensor']<>0) ) { | ||
7 | - $xml = "<?xml version='1.0' encoding='ISO-8859-1'?>\r\n" | ||
8 | - .'<all>'; | ||
9 | - foreach($_POST['sensor'] as $sensor => $value) | ||
10 | - { | ||
11 | - $val = explode(":", $value); | ||
12 | - if(count($types)<>0 && !in_array($val[2], $types)) {$error2 = true;} | ||
13 | - else {$types[] = $val[2];} | ||
14 | - $xml = $xml. '<sensor>' . '<raspberry>' . htmlspecialchars($val[0]) . '</raspberry>' . '<numero>' . htmlspecialchars($val[1]) . '</numero>' . '</sensor>'; | ||
15 | - $xml = $xml."\r\n"; | ||
16 | - } | ||
17 | - $xml = $xml.'</all>'; | ||
18 | - if(!$error2) {file_put_contents('upload/sensor.xml', $xml) ;} | ||
19 | -}*/ | ||
20 | - | ||
21 | -if(isset($_POST['sensor']) && count($_POST['sensor']<>0)) | ||
22 | -{ | ||
23 | - $ini = ""; | ||
24 | - $arduino_simple = "[Arduino]\r\n"; | ||
25 | - $arduino_spi = "[Arduino_spi]\r\n"; | ||
26 | - $nucleo = "[Nucleo]\r\n"; | ||
27 | - $a_simple = false; | ||
28 | - $a_spi = false; | ||
29 | - $n = false; | ||
30 | - foreach($_POST['sensor'] as $sensor => $value) | ||
31 | - { | ||
32 | - $val = explode(":", $value); | ||
33 | - if(count($types)<>0 && !in_array($val[2], $types)) {$error = true;} | ||
34 | - else {$types[] = $val[2];} | ||
35 | - $version = 1;//getSensorVersion($val[0], $val[1]); | ||
36 | - if($version == 0) | ||
37 | - { | ||
38 | - $a_simple = true; | ||
39 | - $arduino_simple = $arduino_simple.$val[0]." capteur=".$val[1]."\n"; | ||
40 | - } | ||
41 | - elseif($version == 1) | ||
42 | - { | ||
43 | - $a_spi = true; | ||
44 | - $arduino_spi = $arduino_spi.$val[0]." capteur=".$val[1]."\n"; | ||
45 | - } | ||
46 | - elseif($version == 2) | ||
47 | - { | ||
48 | - $n = true; | ||
49 | - $nucleo = $nucleo.$val[0]." capteur=".$val[1]."\n"; | ||
50 | - } | ||
51 | - } | ||
52 | - echo $arduino_simple; | ||
53 | - echo $arduino_spi; | ||
54 | - echo $nucleo; | ||
55 | - if($a_simple) {$ini = $ini.$arduino_simple."\n";} | ||
56 | - if($a_spi) {$ini = $ini.$arduino_spi."\n";} | ||
57 | - if($n) {$ini = $ini.$nucleo."\n";} | ||
58 | - if(!$error) {file_put_contents('upload/inventaire.ini', $ini);} | ||
59 | -} | ||
60 | -?> | ||
61 | -<!DOCTYPE html> | ||
62 | - | ||
63 | -<html> | ||
64 | - <head> | ||
65 | - <?php include("head.php"); ?> | ||
66 | - </head> | ||
67 | - | ||
68 | - <!-- Contenu du site --> | ||
69 | - <body> | ||
70 | - <?php | ||
71 | - include("header.php"); | ||
72 | - if(!$error) | ||
73 | - { | ||
74 | - $upload1 = upload('fichier',FALSE, array('c', 'txt') ); | ||
75 | - ?> | ||
76 | - <div class="row"> | ||
77 | - <div class="col-4 col-md-4 offset-md-4 offset-4"> | ||
78 | - <br/> | ||
79 | - <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fa fa-cloud"></i> Envoi du fichier en ligne</h1> | ||
80 | - <?php if($upload1){ | ||
81 | - ?> | ||
82 | - <div class="alert alert-success" role="alert"> | ||
83 | - Upload du fichier réussi ! | ||
84 | - </div> | ||
85 | - <?php | ||
86 | - } | ||
87 | - else {?> | ||
88 | - <div class="alert alert-danger" role="alert"> | ||
89 | - Erreur lors du transfert du fichier ! | ||
90 | - </div><?php | ||
91 | - } | ||
92 | - ?> | ||
93 | - <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fa fa-info-circle"></i> Informations complémentaires</h1> | ||
94 | - <table class="table table-striped table-bordered"> | ||
95 | - <tbody> | ||
96 | - <tr> | ||
97 | - <td>Nom du fichier</td> | ||
98 | - <td><?php echo $_FILES['fichier']['name'];?></td> | ||
99 | - </tr> | ||
100 | - <tr> | ||
101 | - <td>Type</td> | ||
102 | - <td><?php echo $_FILES['fichier']['type'];?></td> | ||
103 | - </tr> | ||
104 | - <tr> | ||
105 | - <td>Localisation</td> | ||
106 | - <td><?php echo $_FILES['fichier']['tmp_name'];?></td> | ||
107 | - </tr> | ||
108 | - <tr> | ||
109 | - <td>Erreur</td> | ||
110 | - <td><?php echo $_FILES['fichier']['error'];?></td> | ||
111 | - </tr> | ||
112 | - <tr> | ||
113 | - <td>Taille</td> | ||
114 | - <td><?php echo $_FILES['fichier']['size'];?></td> | ||
115 | - | ||
116 | - </tr> | ||
117 | - </tbody> | ||
118 | - </table> | ||
119 | - | ||
120 | - </div> | ||
121 | - </div> | ||
122 | - <?php } | ||
123 | - else | ||
124 | - { | ||
125 | - ?> | ||
126 | - <div class="row"> | ||
127 | - <div class="col-4 col-md-4 offset-md-4 offset-4"> | ||
128 | - <br/> | ||
129 | - <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fa fa-cloud"></i> Envoi du fichier en ligne</h1> | ||
130 | - <div class="alert alert-danger" role="alert"> | ||
131 | - Vous devez choisir des capteurs de même type ! | ||
132 | - </div> | ||
133 | - <meta http-equiv="Refresh" content="3;url=send.php" /> | ||
134 | - </div> | ||
135 | - </div> | ||
136 | - <?php | ||
137 | - } | ||
138 | - ?> | ||
139 | - </body> | ||
140 | -</html> |