Commit c455f82aeb6a53e13a0665c7b5fd09d7fe1f22a6

Authored by grouille
1 parent 65577c6e

MAJ

Showing 2 changed files with 15 additions and 0 deletions   Show diff stats
site/accesBase.php
... ... @@ -362,4 +362,18 @@
362 362 deconnexion($db);
363 363 return $tab['numero'];
364 364 }
  365 +
  366 + function getTime($type)
  367 + {
  368 + $db = connexion();
  369 + $query = "INSERT INTO types values('Température', 5)";
  370 + $result = pg_query($db, $query) or die("La requ te a echou : ".pg_last_error());
  371 + $query = "INSERT INTO types values('Distance', 1)";
  372 + $result = pg_query($db, $query) or die("La requ te a echou : ".pg_last_error());
  373 + $query = "SELECT temps FROM types WHERE nom = '$type'";
  374 + $result = pg_query($db, $query) or die("La requ te a echou : ".pg_last_error());
  375 + $tab = pg_fetch_assoc($result);
  376 + deconnexion($db);
  377 + return $tab['temps'];
  378 + }
365 379 ?>
... ...
site/add.php
... ... @@ -47,6 +47,7 @@ session_start();
47 47 setup($_POST['raspberry']);
48 48  
49 49 $temps = getTime($_POST['type']);
  50 + file_put_contents('upload/temps', $temps);
50 51  
51 52 exec("super cmd.sh");
52 53 ?>
... ...