Blame view

site_projet/recherche.php 3.04 KB
19ae2416   jnduwamu   MAJ du site
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  <?php
  session_start();
  ?>
  <!DOCTYPE html>
  
  <html>
          <head>
                  <?php include("head.php"); ?>
          </head>
  
          <!-- Contenu du site -->
          <body>
                  <?php 
                  include("header.php");
                  if(isset($_SESSION['Login'], $_SESSION['Password']))
                  {
                          ?>
  			<div class="row">
  			        <div class="col-6 col-md-6 offset-md-3 offset-3">
                  			<br/>
                  			<h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fas fa-history"></i> Historique</h1>
                  			<table class="table table-striped table-bordered">
                          			<tbody>
                                  			<tr>
                                  		        	<td>Nom</td>
                                          			<td>Raspberry</td>
                                          			<td>Type</td>
                                          			<td>Valeur</td>
                                          			<td>Unité</td>
                                          			<td>Date</td>
                                  			</tr>
  
                                  			<div id="sensors">
                                          			<?php
  								$name = $_POST['nom'];
  								$type = $_POST['type'];
  								$raspberry = $_POST['raspberry'];
  								$start = $_POST['start-date'];
  								$end = $_POST['end-date'];
  								if(($end == NULL) || ($end < $start)) {$e = date_max(); $end = $e['max'];}
  								else $end = $end." 23:59:59";
  								if($start == NULL) {$s = date_min(); $start = $s['min'];}
  								else $start = $start."  00:00:00";?>
                                          			<?php
  								$history = getHistory($name, $type, $raspberry, $start, $end, $_POST['nombre']);
                                          			foreach($history as $sensor){
                                                  			?>
                                                  			<tr>
                                                          			<td><?php echo $sensor['name'];?></td>
                                                          			<td><?php echo $sensor['raspberry'];?></td>
                                                          			<td><?php echo $sensor['type'];?></td>
                                                          			<td><?php echo $sensor['value'];?></td>
                                                          			<td><?php echo $sensor['unite'];?></td>
                                                          			<td><?php echo $sensor['date'];?></td>
                                                  			</tr>
                                                  			<?php
                                          			}
                                          			?>
                                  			</div>
                          			</tbody>
                  			</table>
          			</div>
  			</div>
  			<?php
                  }
                  else
                  {
                          include("formConnexion.php");
                  }
                  ?>
          </body>
  </html>