-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_capteur.php
More file actions
37 lines (28 loc) · 1.04 KB
/
add_capteur.php
File metadata and controls
37 lines (28 loc) · 1.04 KB
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
<?php
include_once("includes/AccesBase.php");
include_once("Modeles/fonction.php");
if(!empty($_SESSION)){
$erreur="";
$ListeBoitier = $db->query('SELECT * FROM boitier ORDER BY idBoitier DESC');
if(!empty($_POST['Type']) AND !empty($_POST['Valeur_init']) AND !empty($_POST['Seuil'])){
$type_cap = htmlspecialchars($_POST['Type']);
$val_init = htmlspecialchars($_POST['Valeur_init']);
$seuil = htmlspecialchars($_POST['Seuil']);
if($_SESSION['Type']=='Gestionnaire'){
//Si c'est un gestionnaire qui fait l'ajout de capteurs, alors on lui associe directement le boîtier auquel le gestionnaire est lié
$req = insertCapteur($db, $type_cap, $val_init, $seuil, $_SESSION['idBoitier']);
}
else{
$ref = htmlspecialchars($_POST['reference']);
$entit = $db->query("SELECT * FROM boitier WHERE Reference='$ref'");
$i_entit = $entit->fetch();
$req = insertCapteur($db, $type_cap, $val_init, $seuil, $i_entit['idBoitier']);
}
$erreur="";
include('monEspace.php');
}
else{
include('Vues/add_capteur.vue.php');
}
}
?>