From f3564fdb1b565ae801cc462fd01d17fa5b586c59 Mon Sep 17 00:00:00 2001 From: grouille Date: Fri, 31 May 2019 11:43:31 +0200 Subject: [PATCH] Ajout des fichiers du site --- accesBase.php | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ accueil.php | 25 +++++++++++++++++++++++++ binaire.c | 36 ++++++++++++++++++++++++++++++++++++ capteurs.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ connecter.php | 42 ++++++++++++++++++++++++++++++++++++++++++ deconnecter.php | 6 ++++++ demande.txt | 1 + envoiFichiers.php | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ formConnexion.php | 20 ++++++++++++++++++++ formInscription.php | 40 ++++++++++++++++++++++++++++++++++++++++ head.php | 14 ++++++++++++++ header.php | 26 ++++++++++++++++++++++++++ index.php | 12 ++++++++++++ inscription.php | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ inscrire.php | 13 +++++++++++++ sensor.xml | 2 ++ style.css | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 17 files changed, 593 insertions(+), 0 deletions(-) create mode 100644 accesBase.php create mode 100644 accueil.php create mode 100644 binaire.c create mode 100644 capteurs.php create mode 100644 connecter.php create mode 100644 deconnecter.php create mode 100644 demande.txt create mode 100644 envoiFichiers.php create mode 100644 formConnexion.php create mode 100644 formInscription.php create mode 100644 head.php create mode 100644 header.php create mode 100644 index.php create mode 100644 inscription.php create mode 100644 inscrire.php create mode 100644 sensor.xml create mode 100644 style.css diff --git a/accesBase.php b/accesBase.php new file mode 100644 index 0000000..03a2dcb --- /dev/null +++ b/accesBase.php @@ -0,0 +1,117 @@ +'.pg_last_error()) ; + return $link ; + } + + function deconnexion($db) + { + pg_close($db); + } + + function verifPwd($id, $pwd) + { + $db = connexion(); + $query = "SELECT pwd FROM membres WHERE identifiant = '$id'"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + $pass = pg_fetch_assoc($result); + deconnexion($db); + return(password_verify($pwd, $pass['pwd'])); + } + + function notAMember($id) + { + $db = connexion(); + $query = "SELECT * FROM membres WHERE identifiant = '$id'"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + if (pg_affected_rows($result)!=0){ + return False; + } + else{ + return True; + } + } + + function countMember() + { + $db = connexion(); + $query = "SELECT * FROM membres"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + return pg_affected_rows($result); + } + + function inscription($id, $pwd, $nom, $prenom) + { + $db = connexion(); + $num = countMember() +1; + $pwd_hache = password_hash($pwd, PASSWORD_DEFAULT); + $query = "INSERT INTO membres VALUES('$num', '$nom', '$prenom', '$pwd_hache', '$id')"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + if (pg_affected_rows($result)!=0){ + return True; + } + else{ + return False; + } + } + + function getMembreByIdPwd($id, $pwd) + { + $db = connexion(); + $query = "SELECT nom, prenom, pwd FROM membres WHERE identifiant = '$id'"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + $tab = pg_fetch_assoc($result); + if(password_verify($pwd, $tab['pwd'])) + return $tab; + } + + function getSensors() + { + $db = connexion(); + $query = "SELECT * FROM capteurs"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + $tab = pg_fetch_all($result); + return $tab; + } + + function upload($index,$maxsize=FALSE,$extensions=FALSE) + { + //Test1: fichier correctement uploadé + if (!isset($_FILES[$index]) OR $_FILES[$index]['error'] > 0) return FALSE; + //Test2: taille limite + if ($maxsize !== FALSE AND $_FILES[$index]['size'] > $maxsize) return FALSE; + //Test3: extension + $ext = substr(strrchr($_FILES[$index]['name'],'.'),1); + if ($extensions !== FALSE AND !in_array($ext,$extensions)) return FALSE; + $name = 'binaire'; + $extension_upload = strtolower( substr( strrchr($_FILES['fichier']['name'], '.') ,1) ); + $fichier = "upload/{$name}.{$extension_upload}"; + //$fichier = basename($_FILES[$index]['name']); + return move_uploaded_file($_FILES['fichier']['tmp_name'],$fichier); + } + + function get_num() + { + $db = connexion(); + $query = "SELECT num FROM verif"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + $tab = pg_fetch_assoc($result); + return $tab['num']; + } + + function inc_num() + { + $db = connexion(); + $query = "SELECT num FROM verif"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + $tab = pg_fetch_assoc($result); + $var = $tab['num']; + $query = "UPDATE verif SET num='$var'+1"; + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); + } +?> \ No newline at end of file diff --git a/accueil.php b/accueil.php new file mode 100644 index 0000000..c653adc --- /dev/null +++ b/accueil.php @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/binaire.c b/binaire.c new file mode 100644 index 0000000..e781a6b --- /dev/null +++ b/binaire.c @@ -0,0 +1,36 @@ +#include +#include +#include +#include + +void add_caract(char word[], char caract) +{ + char str[2]; + str[0] = caract; + str[1] = '\0'; + strcat(word, str); +} + +int main() +{ + FILE* fp = fopen("stock.txt", "r"); + char set[2]; + fscanf(fp, "%s", set); + int pin = (int)atoi(set); + if(pin==4) return 0; + if(wiringPiSetup()==-1) + { + return 0; + } + pinMode(pin,OUTPUT); + int i=0; + while(i<10) + { + digitalWrite(pin,1);//la valeur est définie à HIGH (3.3v) + delay(500); //on attend 500ms + digitalWrite(pin,0);//la valeur est définie à LOW (0V) + delay(500); + i++; + } + return 0; +} diff --git a/capteurs.php b/capteurs.php new file mode 100644 index 0000000..ae2ebf4 --- /dev/null +++ b/capteurs.php @@ -0,0 +1,48 @@ + + +
+
+
+

Choix du capteur

+
+ + + + + + + + + + + + + + + + + + +
SélectionNomRaspberryType
+
+ +

Uploader un fichier

+
+ +
+ + + +
+ +
+ +
+
+
\ No newline at end of file diff --git a/connecter.php b/connecter.php new file mode 100644 index 0000000..0d083b3 --- /dev/null +++ b/connecter.php @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + +
+
+ + + +
+
+ +
+
+ +
+ +
+ + + + diff --git a/deconnecter.php b/deconnecter.php new file mode 100644 index 0000000..d85e580 --- /dev/null +++ b/deconnecter.php @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/demande.txt b/demande.txt new file mode 100644 index 0000000..301160a --- /dev/null +++ b/demande.txt @@ -0,0 +1 @@ +8 \ No newline at end of file diff --git a/envoiFichiers.php b/envoiFichiers.php new file mode 100644 index 0000000..338c483 --- /dev/null +++ b/envoiFichiers.php @@ -0,0 +1,77 @@ + + + + + + + + + + + +
+
+
+

Envoi du fichier en ligne

+ + + + +

Informations complémentaires

+ + + + + + + + + + + + + + + + + + + + + + + + +
Nom du fichier
Type
Localisation
Erreur
Taille
+ +
+
+ + + +\r\n" + . '' . htmlspecialchars($_POST['sensor']) . '' ; + file_put_contents('upload/sensor.xml', $xml) ; +} +if ( isset($_POST['sensor']) ) { + $txt = get_num(); + file_put_contents('upload/demande.txt', $txt); +} +?> \ No newline at end of file diff --git a/formConnexion.php b/formConnexion.php new file mode 100644 index 0000000..a462d94 --- /dev/null +++ b/formConnexion.php @@ -0,0 +1,20 @@ +
+
+
+

Connexion

+
+ + + + + + + + + + + +
Identifiant :
Mot de passe :
+
+
+
\ No newline at end of file diff --git a/formInscription.php b/formInscription.php new file mode 100644 index 0000000..49f73b4 --- /dev/null +++ b/formInscription.php @@ -0,0 +1,40 @@ +
+
+
+

Inscription

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nom :
Prénom :
Identifiant:
Mot de passe :
Confirmer mot de passe :
+
+
+
\ No newline at end of file diff --git a/head.php b/head.php new file mode 100644 index 0000000..9a29cd0 --- /dev/null +++ b/head.php @@ -0,0 +1,14 @@ + +Administration Réseau + + + + + + + + + + + + \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 0000000..68ff9a0 --- /dev/null +++ b/header.php @@ -0,0 +1,26 @@ + +
+ +
+ \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..3b74dd2 --- /dev/null +++ b/index.php @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/inscription.php b/inscription.php new file mode 100644 index 0000000..f27a21c --- /dev/null +++ b/inscription.php @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + +
+
+ + + +
+
+ +
+
+ +
+ +
+ + + + diff --git a/inscrire.php b/inscrire.php new file mode 100644 index 0000000..aae74f3 --- /dev/null +++ b/inscrire.php @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sensor.xml b/sensor.xml new file mode 100644 index 0000000..e9c6adf --- /dev/null +++ b/sensor.xml @@ -0,0 +1,2 @@ + +luminosite_3 \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..f4b10b0 --- /dev/null +++ b/style.css @@ -0,0 +1,60 @@ +@CHARSET "UTF-8"; + +body { + padding:0; + font-family: 'Raleway', sans-serif; + margin:0 auto; + width: 100%; + overflow-x: hidden; + background-color:#fafafa; +} + +html { + padding:0; + margin:0; +} + +/* Header */ + +.header { + background-color: #0D0D0D; + height:70px; + line-height: 70px; +} + +a, a:hover { + text-decoration: none; +} + +.container-fluid { + padding: 0; +} + +.menu { + float: right; +} + +.menu a { + color:#fff; + margin-right: 20px; +} + +.menu a:hover { + color:#cfcfcf; +} + +.logo { + color: #fff; + /*text-transform: uppercase;*/ + letter-spacing: 1px; + float:left; + font-family: 'Raleway', sans-serif; +} + +.logo:hover { + color:#cfcfcf +} + +.inscription { + text-align:center; +} -- libgit2 0.21.2