From 7cf5c3a9e9fad6c88ab4f87e2fbae7408ddf97f1 Mon Sep 17 00:00:00 2001 From: Enzo Freitas Date: Wed, 3 Jun 2026 15:29:43 +0200 Subject: [PATCH] Fix dossier frontend submodule --- smart-house---final- | 1 - smart-house---final-/.idea/modules.xml | 8 + smart-house---final-/.idea/php.xml | 19 + .../.idea/smart-house---final-.iml | 8 + smart-house---final-/.idea/vcs.xml | 6 + smart-house---final-/.idea/workspace.xml | 65 ++ smart-house---final-/404.php | 16 + smart-house---final-/README.md | 126 +++ smart-house---final-/admin_logs.php | 42 + smart-house---final-/admin_settings.php | 68 ++ smart-house---final-/admin_users.php | 159 ++++ smart-house---final-/dashboard.js | 102 +++ smart-house---final-/dashboard.php | 58 ++ smart-house---final-/form_login_register.php | 25 + smart-house---final-/gen.php | 4 + smart-house---final-/include/footer.php | 28 + smart-house---final-/include/header.php | 17 + smart-house---final-/include/nav.php | 17 + .../include/session_check.php | 36 + smart-house---final-/index.php | 37 + smart-house---final-/js/chart.min.js | 0 smart-house---final-/login.php | 106 +++ smart-house---final-/logout.php | 5 + smart-house---final-/main.php | 4 + smart-house---final-/personne1.php | 8 + smart-house---final-/profil.php | 83 ++ smart-house---final-/register.php | 60 ++ smart-house---final-/settings.json.php | 6 + smart-house---final-/style.css | 747 ++++++++++++++++++ smart-house---final-/test.php | 15 + smart-house---final-/users.json.php | 6 + 31 files changed, 1881 insertions(+), 1 deletion(-) delete mode 160000 smart-house---final- create mode 100644 smart-house---final-/.idea/modules.xml create mode 100644 smart-house---final-/.idea/php.xml create mode 100644 smart-house---final-/.idea/smart-house---final-.iml create mode 100644 smart-house---final-/.idea/vcs.xml create mode 100644 smart-house---final-/.idea/workspace.xml create mode 100644 smart-house---final-/404.php create mode 100644 smart-house---final-/README.md create mode 100644 smart-house---final-/admin_logs.php create mode 100644 smart-house---final-/admin_settings.php create mode 100644 smart-house---final-/admin_users.php create mode 100644 smart-house---final-/dashboard.js create mode 100644 smart-house---final-/dashboard.php create mode 100644 smart-house---final-/form_login_register.php create mode 100644 smart-house---final-/gen.php create mode 100644 smart-house---final-/include/footer.php create mode 100644 smart-house---final-/include/header.php create mode 100644 smart-house---final-/include/nav.php create mode 100644 smart-house---final-/include/session_check.php create mode 100644 smart-house---final-/index.php create mode 100644 smart-house---final-/js/chart.min.js create mode 100644 smart-house---final-/login.php create mode 100644 smart-house---final-/logout.php create mode 100644 smart-house---final-/main.php create mode 100644 smart-house---final-/personne1.php create mode 100644 smart-house---final-/profil.php create mode 100644 smart-house---final-/register.php create mode 100644 smart-house---final-/settings.json.php create mode 100644 smart-house---final-/style.css create mode 100644 smart-house---final-/test.php create mode 100644 smart-house---final-/users.json.php diff --git a/smart-house---final- b/smart-house---final- deleted file mode 160000 index 4188ca3..0000000 --- a/smart-house---final- +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4188ca3abcaa0bc94a2bc159947cdaa0e50a4746 diff --git a/smart-house---final-/.idea/modules.xml b/smart-house---final-/.idea/modules.xml new file mode 100644 index 0000000..ba36e03 --- /dev/null +++ b/smart-house---final-/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/smart-house---final-/.idea/php.xml b/smart-house---final-/.idea/php.xml new file mode 100644 index 0000000..f324872 --- /dev/null +++ b/smart-house---final-/.idea/php.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/smart-house---final-/.idea/smart-house---final-.iml b/smart-house---final-/.idea/smart-house---final-.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/smart-house---final-/.idea/smart-house---final-.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/smart-house---final-/.idea/vcs.xml b/smart-house---final-/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/smart-house---final-/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/smart-house---final-/.idea/workspace.xml b/smart-house---final-/.idea/workspace.xml new file mode 100644 index 0000000..5b87c87 --- /dev/null +++ b/smart-house---final-/.idea/workspace.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + { + "associatedIndex": 3, + "fromUser": false +} + + + + + + + + + + + + + + 1780320829467 + + + + + + \ No newline at end of file diff --git a/smart-house---final-/404.php b/smart-house---final-/404.php new file mode 100644 index 0000000..319e56e --- /dev/null +++ b/smart-house---final-/404.php @@ -0,0 +1,16 @@ + + +
+
+

404

+

Page introuvable

+

La page que vous cherchez n'existe pas ou a été déplacée.

+ 🏠 Retour au dashboard +
+
+ + \ No newline at end of file diff --git a/smart-house---final-/README.md b/smart-house---final-/README.md new file mode 100644 index 0000000..7a92275 --- /dev/null +++ b/smart-house---final-/README.md @@ -0,0 +1,126 @@ +# 🏠 Smart House + +Application web de tableau de bord domotique développée en PHP, permettant de surveiller et gérer une maison intelligente. + +--- + +## 📋 Présentation + +Smart House est un dashboard web qui permet de visualiser en temps réel les données de capteurs (climat, sécurité, énergie, lumière) et de gérer les utilisateurs avec un système de rôles Admin/User. + +--- + +## ✨ Fonctionnalités + +### Authentification +- Connexion / Inscription sécurisée +- Blocage après 3 tentatives échouées (5 minutes) +- Déconnexion automatique après 15 minutes d'inactivité +- Régénération de session après connexion + +### Gestion des utilisateurs +- Inscription avec validation obligatoire par l'admin +- Système de rôles : Admin / User +- Profil utilisateur (changement de mot de passe) +- Promotion / Rétrogradation des utilisateurs + +### Dashboard +- Widget Climat (Température, Humidité, Pression, Altitude) +- Widget Sécurité (Mouvement, Distance) +- Widget Énergie (Puissance, Consommation) +- Widget Lumière (Lux) +- Graphiques Chart.js +- Widget Alertes + +### Administration +- Gestion des utilisateurs (accepter, refuser, supprimer, changer le rôle) +- Paramètres du site (nom, tentatives max, durée session, message d'accueil) +- Logs du dashboard + +### Interface +- Mode sombre / clair +- Design responsive (mobile, tablette, desktop) +- Page 404 personnalisée + +--- + +## 📁 Structure des fichiers + + smart-house---final-/ + include/ + header.php # En-tête HTML commun + footer.php # Pied de page commun + nav.php # Barre de navigation + session_check.php # Vérification de session + js/ + chart.min.js # Chart.js local + index.php # Page d'accueil + login.php # Page de connexion + register.php # Page d'inscription + logout.php # Déconnexion + dashboard.php # Tableau de bord + profil.php # Profil utilisateur + admin_users.php # Gestion des utilisateurs (Admin) + admin_settings.php # Paramètres du site (Admin) + admin_logs.php # Logs (Admin) + 404.php # Page d'erreur 404 + dashboard.js # Scripts du dashboard + style.css # Styles CSS + users.json.php # Base de données utilisateurs + settings.json.php # Paramètres du site + +--- + +## 🚀 Installation + +### Prérequis +- PHP 7.4 ou supérieur +- Serveur web (Apache, Nginx, ou serveur PHP intégré) + +### Lancement avec le serveur PHP intégré + + php -S localhost:8000 + +Puis ouvrir dans le navigateur : + + http://localhost:8000/ + +--- + +## 🔐 Comptes et accès + +### Compte Admin +- Nom d'utilisateur : Kari +- Mot de passe : Levasseur +- Rôle : Admin + +### Compte Utilisateur +Les utilisateurs s'inscrivent via la page /register.php et doivent être validés par l'admin avant de pouvoir se connecter. + +--- + +## 🛡️ Sécurité + +- Mots de passe hashés avec password_hash() (bcrypt) +- Protection contre les attaques par force brute (blocage 5 min après 3 échecs) +- Régénération de l'ID de session après connexion +- Vérification du rôle à chaque chargement de page +- Déconnexion automatique après inactivité +- Protection des pages admin (redirection si non Admin) +- Échappement des données avec htmlspecialchars() + +--- + +## 🛠️ Technologies utilisées + +- PHP — Backend et gestion des sessions +- HTML / CSS — Interface utilisateur +- JavaScript — Interactions dynamiques +- Chart.js — Graphiques +- JSON — Stockage des données utilisateurs et paramètres + +--- + +## 📅 Année + +2026 \ No newline at end of file diff --git a/smart-house---final-/admin_logs.php b/smart-house---final-/admin_logs.php new file mode 100644 index 0000000..307e888 --- /dev/null +++ b/smart-house---final-/admin_logs.php @@ -0,0 +1,42 @@ + +
+
+

Logs du Dashboard

+

Bienvenue, (Admin)

+

Modifications récentes

+
    +
  • Aucune modification pour l'instant.
  • +
+

Alertes récentes

+
    +
  • Aucune alerte pour l'instant.
  • +
+
+
+ + \ No newline at end of file diff --git a/smart-house---final-/admin_settings.php b/smart-house---final-/admin_settings.php new file mode 100644 index 0000000..3e68d11 --- /dev/null +++ b/smart-house---final-/admin_settings.php @@ -0,0 +1,68 @@ + 'Smart House', + 'max_attempts' => 3, + 'session_timeout' => 900, + 'welcome_message' => 'Bienvenue sur votre tableau de bord Smart House.' +]; +$success = ''; + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $settings['site_name'] = trim($_POST['site_name']); + $settings['max_attempts'] = (int)$_POST['max_attempts']; + $settings['session_timeout'] = (int)$_POST['session_timeout'] * 60; + $settings['welcome_message'] = trim($_POST['welcome_message']); + + file_put_contents($settingsFile, json_encode($settings, JSON_PRETTY_PRINT)); + $success = "Paramètres sauvegardés avec succès !"; +} + +include 'include/header.php'; +?> + +
+
+

⚙️ Paramètres du site

+ + +

+ + +
+ + + + + + + + + + + + + + +
+
+
+ + \ No newline at end of file diff --git a/smart-house---final-/admin_users.php b/smart-house---final-/admin_users.php new file mode 100644 index 0000000..9fa4a39 --- /dev/null +++ b/smart-house---final-/admin_users.php @@ -0,0 +1,159 @@ + + +
+
+

👥 Gestion des utilisateurs

+ + +

+ + +

+ + + + + +

⏳ Comptes en attente de validation

+ + + + + + + + + + $data): ?> + + + + + + + +
Nom d'utilisateurStatutActions
En attente + ✅ Accepter + + ❌ Refuser + +
+ + + +

✅ Comptes actifs

+ + + + + + + + + + $data): + if (isset($data['statut']) && $data['statut'] === 'en_attente') continue; + ?> + + + + + + + +
Nom d'utilisateurRôleActions
+ + (vous) + + + + + + + + + + + + 🗑️ Supprimer + + + — compte actuel — + +
+
+
+ + \ No newline at end of file diff --git a/smart-house---final-/dashboard.js b/smart-house---final-/dashboard.js new file mode 100644 index 0000000..a8b1f53 --- /dev/null +++ b/smart-house---final-/dashboard.js @@ -0,0 +1,102 @@ +/* global Chart */ +// ------------------------------- +// 1️⃣ Sélection des widgets +// ------------------------------- +const climat = document.querySelector('.widget.climat'); +const securite = document.querySelector('.widget.securite'); +const energie = document.querySelector('.widget.energie'); +const lumiere = document.querySelector('.widget.lumiere'); +const alertes = document.querySelector('.widget.alertes'); +// ------------------------------- +// 2️⃣ Hover dynamique sur les widgets +// ------------------------------- +function setupHover(widget, colorNormal, colorHover) { + widget.addEventListener('mouseenter', () => { + widget.style.backgroundColor = colorHover; + }); + widget.addEventListener('mouseleave', () => { + widget.style.backgroundColor = colorNormal; + }); +} +setupHover(climat, '#ADD8E6', '#87CEEB'); +setupHover(securite, '#D3D3D3', '#C0C0C0'); +setupHover(energie, '#FFFACD', '#FAFAD2'); +setupHover(lumiere, '#F5F5DC', '#FFF8DC'); +// ------------------------------- +// 3️⃣ Simulation d'alerte visuelle +// ------------------------------- +function showAlert(widget) { + widget.classList.add('alert'); +} +showAlert(climat); +alertes.style.display = 'block'; +// ------------------------------- +// 4️⃣ Graphique Chart.js +// ------------------------------- +const canvasTemp = document.getElementById('graph-temp'); +if(canvasTemp) { + const ctx = canvasTemp.getContext('2d'); + new Chart(ctx, { + type: 'line', + data: { + labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'], + datasets: [{ + label: 'Température', + data: [20, 22, 19, 23, 21], + borderColor: 'blue', + backgroundColor: 'rgba(173,216,230,0.2)', + tension: 0.4 + }] + }, + options: { + responsive: true, + plugins: { + legend: { display: true } + }, + scales: { + x: { display: true, title: { display: true, text: 'Mois' } }, + y: { display: true, title: { display: true, text: '°C' } } + } + } + }); +} +// ------------------------------- +// 5️⃣ Données réelles depuis l'API +// ------------------------------- +const API_BASE = "http://192.168.10.1:8080"; + +async function init() { + const res = await fetch(`${API_BASE}/auth.php`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ username: "admin", password: "admin123" }) + }); + const data = await res.json(); + const token = data.token; + await chargerClimat(token); + await chargerSecurite(token); +} + +async function chargerClimat(token) { + const res = await fetch(`${API_BASE}/routes/climate.php`, { + headers: { "Authorization": "Bearer " + token } + }); + const data = await res.json(); + const last = Array.isArray(data) ? data[data.length - 1] : data; + document.getElementById("temperature").textContent = last.temperature + " °C"; + document.getElementById("humidity").textContent = last.humidity + " %"; + document.getElementById("pressure").textContent = last.pressure + " hPa"; + document.getElementById("luminosity").textContent = last.luminosity + " lux"; +} + +async function chargerSecurite(token) { + const res = await fetch(`${API_BASE}/routes/security.php`, { + headers: { "Authorization": "Bearer " + token } + }); + const data = await res.json(); + const last = Array.isArray(data) ? data[data.length - 1] : data; + document.getElementById("event_type").textContent = last.event_type; + document.getElementById("location").textContent = last.location; +} + +init(); \ No newline at end of file diff --git a/smart-house---final-/dashboard.php b/smart-house---final-/dashboard.php new file mode 100644 index 0000000..0838a56 --- /dev/null +++ b/smart-house---final-/dashboard.php @@ -0,0 +1,58 @@ + +
+
+

Dashboard Smart House

+

+ Bienvenue, + () +

+ +

Vous êtes Admin, vous pouvez gérer le site.

+ +

Vous êtes Utilisateur, votre accès est limité.

+ +
+ +
+
+ 🌡️ + Climat +

Température :

+

Humidité :

+

Pression :

+

Luminosité :

+
+
+ 🚨 + Sécurité +

Événement :

+

Lieu :

+
+
+ + Énergie +

Puissance : –

+

Consommation : –

+
+
+ 💡 + Lumière +

Lux : –

+
+
+ 📊 + Graphiques + +
+
+ ⚠️ + Alertes +

– Aucune alerte pour l'instant –

+
+
+
+ \ No newline at end of file diff --git a/smart-house---final-/form_login_register.php b/smart-house---final-/form_login_register.php new file mode 100644 index 0000000..916bfb2 --- /dev/null +++ b/smart-house---final-/form_login_register.php @@ -0,0 +1,25 @@ + + + +

+ + +
+ + + + + + + +
\ No newline at end of file diff --git a/smart-house---final-/gen.php b/smart-house---final-/gen.php new file mode 100644 index 0000000..19251de --- /dev/null +++ b/smart-house---final-/gen.php @@ -0,0 +1,4 @@ + +

© 2026 Smart House

+ + + \ No newline at end of file diff --git a/smart-house---final-/include/header.php b/smart-house---final-/include/header.php new file mode 100644 index 0000000..cf8519d --- /dev/null +++ b/smart-house---final-/include/header.php @@ -0,0 +1,17 @@ + + + + + Smart House + + + + + + + + + \ No newline at end of file diff --git a/smart-house---final-/include/nav.php b/smart-house---final-/include/nav.php new file mode 100644 index 0000000..9b827d1 --- /dev/null +++ b/smart-house---final-/include/nav.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/smart-house---final-/include/session_check.php b/smart-house---final-/include/session_check.php new file mode 100644 index 0000000..801faef --- /dev/null +++ b/smart-house---final-/include/session_check.php @@ -0,0 +1,36 @@ + $timeout) { + session_destroy(); + header("Location: login.php?timeout=1"); + exit(); + } +} + +// Mettre à jour le temps de dernière activité +$_SESSION['last_activity'] = time(); \ No newline at end of file diff --git a/smart-house---final-/index.php b/smart-house---final-/index.php new file mode 100644 index 0000000..1d6efc4 --- /dev/null +++ b/smart-house---final-/index.php @@ -0,0 +1,37 @@ + + +
+
+

🏠 Bienvenue sur Smart House

+

Gérez votre maison intelligente en toute simplicité.
Confort, sécurité et énergie au bout des doigts.

+ Accéder au dashboard +
+ +
+
+ 🌡️ +

Climat

+

Surveillez température, humidité et pression.

+
+
+ 🚨 +

Sécurité

+

Gardez un œil sur votre maison en temps réel.

+
+
+ +

Énergie

+

Optimisez votre consommation électrique.

+
+
+ 💡 +

Lumière

+

Contrôlez l'éclairage intelligemment.

+
+
+
+ + \ No newline at end of file diff --git a/smart-house---final-/js/chart.min.js b/smart-house---final-/js/chart.min.js new file mode 100644 index 0000000..e69de29 diff --git a/smart-house---final-/login.php b/smart-house---final-/login.php new file mode 100644 index 0000000..7ceb510 --- /dev/null +++ b/smart-house---final-/login.php @@ -0,0 +1,106 @@ += 3 && $_SESSION['login_time'] !== null) { + $temps_ecoule = time() - $_SESSION['login_time']; + if ($temps_ecoule < 300) { + $bloque = true; + $reste = 300 - $temps_ecoule; + $message = "Trop de tentatives. Réessayez dans " . ceil($reste / 60) . " minute(s)."; + } else { + $_SESSION['login_attempts'] = 0; + $_SESSION['login_time'] = null; + } +} + +if (isset($_GET['registered'])) { + $success = "Compte créé avec succès ! En attente de validation par l'administrateur."; +} + +if (!$bloque && $_SERVER['REQUEST_METHOD'] === 'POST') { + $username = trim($_POST['username']); + $password = trim($_POST['password']); + + if (isset($users[$username]) && password_verify($password, $users[$username]['password'])) { + // Vérifier si le compte est en attente + if (isset($users[$username]['statut']) && $users[$username]['statut'] === 'en_attente') { + $message = "Votre compte est en attente de validation par l'administrateur."; + } else { + $_SESSION['login_attempts'] = 0; + $_SESSION['login_time'] = null; + $_SESSION['user'] = $username; + $_SESSION['role'] = $users[$username]['role']; + $_SESSION['last_activity'] = time(); + session_regenerate_id(true); + header("Location: dashboard.php"); + exit(); + } + } else { + $_SESSION['login_attempts']++; + $_SESSION['login_time'] = time(); + $restants = 3 - $_SESSION['login_attempts']; + if ($restants > 0) { + $message = "Identifiants incorrects. Il vous reste $restants essai(s)."; + } else { + $message = "Trop de tentatives. Réessayez dans 5 minutes."; + } + } +} + +include 'include/header.php'; +?> + +
+

Connexion

+ +

+ + +

+ + + +
+ + + + +
+ + +
+ + +
+ + +
+ + + + \ No newline at end of file diff --git a/smart-house---final-/logout.php b/smart-house---final-/logout.php new file mode 100644 index 0000000..8a4fa80 --- /dev/null +++ b/smart-house---final-/logout.php @@ -0,0 +1,5 @@ + +

Page principale

+

Bienvenue sur le site Smart House.

+ \ No newline at end of file diff --git a/smart-house---final-/personne1.php b/smart-house---final-/personne1.php new file mode 100644 index 0000000..d9f302c --- /dev/null +++ b/smart-house---final-/personne1.php @@ -0,0 +1,8 @@ + 'Exemple', + 'prenom' => 'Utilisateur', + 'email' => 'exemple@site.com', + 'role' => 'Utilisateur', + 'classe' => 'BTS CIEL' +]; \ No newline at end of file diff --git a/smart-house---final-/profil.php b/smart-house---final-/profil.php new file mode 100644 index 0000000..8c959f2 --- /dev/null +++ b/smart-house---final-/profil.php @@ -0,0 +1,83 @@ + + +
+
+

👤 Mon Profil

+ +
+

Nom d'utilisateur :

+

Rôle :

+
+ +
+ +

Changer le mot de passe

+ + +

+ + +

+ + +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+
+ + + + \ No newline at end of file diff --git a/smart-house---final-/register.php b/smart-house---final-/register.php new file mode 100644 index 0000000..5132b0b --- /dev/null +++ b/smart-house---final-/register.php @@ -0,0 +1,60 @@ + $hash, + 'role' => 'User', + 'statut' => 'en_attente' + ]; + file_put_contents($usersFile, json_encode($users, JSON_PRETTY_PRINT)); + header("Location: login.php?registered=1"); + exit(); + } +} + +include 'include/header.php'; +?> + +
+

Créer un compte

+ +

+ +
+ + + + +
+ + +
+ + +
+ +
+ + + + \ No newline at end of file diff --git a/smart-house---final-/settings.json.php b/smart-house---final-/settings.json.php new file mode 100644 index 0000000..f217990 --- /dev/null +++ b/smart-house---final-/settings.json.php @@ -0,0 +1,6 @@ +{ + "site_name": "Smart House", + "max_attempts": 3, + "session_timeout": 900, + "welcome_message": "Bienvenue sur votre tableau de bord Smart House." +} \ No newline at end of file diff --git a/smart-house---final-/style.css b/smart-house---final-/style.css new file mode 100644 index 0000000..f4b8f72 --- /dev/null +++ b/smart-house---final-/style.css @@ -0,0 +1,747 @@ +/* =========================== + GLOBAL +=========================== */ +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: Arial, sans-serif; + background-color: #1e1e1e; + color: #f0f0f0; + min-height: 100vh; + display: flex; + flex-direction: column; +} + +main { + flex: 1; +} + +/* =========================== + NAVBAR +=========================== */ +nav { + background-color: #1a2332; + padding: 0 30px; + height: 60px; + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 0; +} + +.nav-logo { + display: flex; + align-items: center; + gap: 10px; + color: #fff; + font-size: 1.2em; + font-weight: bold; +} + +.nav-logo span { + font-size: 1.5em; +} + +nav ul { + list-style: none; + display: flex; + gap: 20px; + margin: 0; + padding: 0; + align-items: center; +} + +nav ul li a { + text-decoration: none; + color: #ccd6e0; + font-size: 0.95em; + padding: 5px 10px; + border-radius: 5px; + transition: all 0.3s; +} + +nav ul li a:hover { + color: #fff; + background-color: rgba(255,255,255,0.1); +} + +nav ul li a.btn-red { + color: #e74c3c; +} + +nav ul li a.btn-red:hover { + background-color: #e74c3c; + color: white; +} + +#toggle-theme { + background: none; + border: 1px solid #ccd6e0; + color: #ccd6e0; + padding: 5px 10px; + border-radius: 5px; + cursor: pointer; + font-size: 0.95em; + transition: all 0.3s; +} + +#toggle-theme:hover { + background-color: rgba(255,255,255,0.1); +} + +/* =========================== + PAGE ACCUEIL +=========================== */ +.hero { + text-align: center; + padding: 80px 20px 50px; +} + +.hero h2 { + font-size: 2em; + font-weight: bold; + color: #f0f0f0; + margin-bottom: 15px; +} + +.hero p { + color: #aaa; + font-size: 1em; + margin-bottom: 25px; + line-height: 1.6; +} + +.btn-primary { + display: inline-block; + background-color: #3bc4e8; + color: white; + padding: 12px 30px; + border-radius: 25px; + text-decoration: none; + font-weight: bold; + transition: background-color 0.3s; +} + +.btn-primary:hover { + background-color: #2aafd0; +} + +.cards-home { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 20px; + max-width: 1000px; + margin: 40px auto; + padding: 0 20px; +} + +.card-home { + background-color: #2c3e50; + border-radius: 12px; + padding: 30px 20px; + text-align: center; + box-shadow: 0 2px 10px rgba(0,0,0,0.3); +} + +.card-home .icone { + font-size: 2em; + display: block; + margin-bottom: 12px; +} + +.card-home h3 { + font-size: 1em; + font-weight: bold; + margin-bottom: 8px; + color: #f0f0f0; +} + +.card-home p { + font-size: 0.85em; + color: #aaa; + line-height: 1.5; +} + +/* =========================== + FOOTER +=========================== */ +footer { + border-top: 1px solid #333; + padding: 15px 30px; + text-align: left; + font-size: 0.85em; + color: #888; + background-color: #1e1e1e; + margin-top: auto; +} + +footer hr { + display: none; +} + +/* =========================== + FORMULAIRE LOGIN / REGISTER +=========================== */ +.form-box { + width: 360px; + margin: 60px auto; + padding: 30px; + background-color: #2c3e50; + border-radius: 12px; + box-shadow: 0 4px 20px rgba(0,0,0,0.4); + text-align: center; + color: #f0f0f0; +} + +.form-box h2 { + margin-bottom: 25px; + font-size: 1.3em; + color: #f0f0f0; +} + +.form-box h3 { + color: #f0f0f0; +} + +.form-box label.field-label { + display: block; + text-align: left; + font-size: 0.85em; + font-weight: bold; + color: #ccc; + margin-bottom: 5px; + margin-top: 15px; +} + +.form-box input { + width: 100%; + padding: 10px 12px; + border: 1px solid #444; + border-radius: 8px; + font-size: 0.95em; + color: #f0f0f0; + background-color: #1e1e1e; + transition: border 0.3s; +} + +.form-box input:focus { + outline: none; + border-color: #3bc4e8; +} + +.form-box input::placeholder { + color: #666; +} + +.password-wrapper { + position: relative; +} + +.password-wrapper input { + padding-right: 40px; +} + +.toggle-password { + position: absolute; + right: 10px; + top: 50%; + transform: translateY(-50%); + cursor: pointer; + font-size: 1em; + color: #888; + background: none; + border: none; +} + +.form-box button[type="submit"] { + width: 100%; + padding: 12px; + background-color: #3bc4e8; + color: white; + border: none; + border-radius: 25px; + cursor: pointer; + font-size: 1em; + font-weight: bold; + margin-top: 20px; + transition: background-color 0.3s; +} + +.form-box button[type="submit"]:hover { + background-color: #2aafd0; +} + +.form-error { + color: #e74c3c; + font-size: 0.88em; + margin-bottom: 10px; +} + +.form-success { + color: #2ecc71; + font-size: 0.88em; + margin-bottom: 10px; +} + +.form-link { + margin-top: 15px; + font-size: 0.88em; + color: #aaa; +} + +.form-link a { + color: #3bc4e8; + text-decoration: none; +} + +.form-link a:hover { + text-decoration: underline; +} + +/* =========================== + ACCESSIBILITÉ +=========================== */ +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0,0,0,0); + border: 0; +} + +/* =========================== + DASHBOARD +=========================== */ +.dashboard-header { + padding: 30px 30px 10px; +} + +.dashboard-header h2 { + color: #f0f0f0; + font-size: 1.5em; +} + +.dashboard-header p { + color: #aaa; + font-size: 0.95em; +} + +.dashboard { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 15px; + padding: 20px 30px; +} + +/* =========================== + WIDGETS +=========================== */ +.widget { + padding: 20px; + border-radius: 12px; + text-align: center; + box-shadow: 0 2px 8px rgba(0,0,0,0.3); + background-color: #2c3e50; + color: #f0f0f0; +} + +.widget strong { + display: block; + margin-bottom: 8px; + color: #f0f0f0; +} + +.widget p { + font-size: 0.9em; + color: #ccc; +} + +.climat { background-color: #34495e; } +.securite { background-color: #7f8c8d; } +.energie { background-color: #f39c12; } +.lumiere { background-color: #8e44ad; } + +.graphiques { + grid-column: span 4; + background-color: #2c3e50; +} + +.alertes { + grid-column: span 4; + background-color: #c0392b; + color: #fff; +} + +/* =========================== + ICONES +=========================== */ +.icone { + font-size: 2em; + display: block; + margin-bottom: 10px; +} + +/* =========================== + ALERTE ACTIVE +=========================== */ +.alert { + border: 2px solid #e74c3c; +} + +/* =========================== + LOGS / ADMIN +=========================== */ +.logs-container { + padding: 20px 30px; + background-color: #2c3e50; + margin: 20px 30px; + border-radius: 12px; + box-shadow: 0 2px 8px rgba(0,0,0,0.3); + color: #f0f0f0; +} + +.logs-container h2 { + color: #f0f0f0; + margin-bottom: 5px; +} + +.logs-container h3 { + color: #f0f0f0; + margin-bottom: 10px; + margin-top: 20px; +} + +.logs-container ul { + list-style: none; + padding: 0; +} + +.logs-container ul li { + padding: 8px 0; + border-bottom: 1px solid #3d5166; + font-size: 0.9em; + color: #ccc; +} + +/* =========================== + PROFIL +=========================== */ +.profil-info { + text-align: left; + margin-bottom: 10px; +} + +.profil-info p { + padding: 8px 0; + border-bottom: 1px solid #3d5166; + font-size: 0.95em; + color: #ccc; +} + +.profil-info p strong { + color: #f0f0f0; +} + +/* =========================== + TABLEAU ADMIN +=========================== */ +.admin-table { + width: 100%; + border-collapse: collapse; + margin-top: 20px; +} + +.admin-table th { + background-color: #1a2332; + color: #f0f0f0; + padding: 12px 15px; + text-align: left; + font-size: 0.9em; +} + +.admin-table td { + padding: 10px 15px; + border-bottom: 1px solid #3d5166; + font-size: 0.9em; + color: #ccc; +} + +.admin-table tr:hover td { + background-color: #34495e; +} + +.btn-action { + padding: 5px 12px; + border: none; + border-radius: 5px; + cursor: pointer; + font-size: 0.85em; + margin-right: 5px; + transition: all 0.3s; + text-decoration: none; + display: inline-block; +} + +.btn-danger { + background-color: #e74c3c; + color: white; +} + +.btn-danger:hover { + background-color: #c0392b; +} + +.btn-warning { + background-color: #f39c12; + color: white; +} + +.btn-warning:hover { + background-color: #d68910; +} + +/* =========================== + SKELETON LOADING +=========================== */ +@keyframes skeleton-pulse { + 0% { opacity: 1; } + 50% { opacity: 0.4; } + 100% { opacity: 1; } +} + +.skeleton { + background-color: #3d5166; + border-radius: 5px; + height: 14px; + margin: 8px auto; + width: 70%; + animation: skeleton-pulse 1.5s ease-in-out infinite; +} + +/* =========================== + MODE CLAIR +=========================== */ +body.light-mode { + background-color: #f0f2f5; + color: #333; +} + +body.light-mode nav { + background-color: #1a2332; +} + +body.light-mode .card-home { + background-color: #fff; + color: #333; +} + +body.light-mode .card-home h3 { + color: #1a2332; +} + +body.light-mode .card-home p { + color: #888; +} + +body.light-mode .hero h2 { + color: #1a2332; +} + +body.light-mode .hero p { + color: #666; +} + +body.light-mode .form-box { + background-color: #fff; + color: #333; + box-shadow: 0 4px 20px rgba(0,0,0,0.1); +} + +body.light-mode .form-box h2, +body.light-mode .form-box h3 { + color: #1a2332; +} + +body.light-mode .form-box label.field-label { + color: #555; +} + +body.light-mode .form-box input { + background-color: #f0f2f5; + color: #333; + border-color: #ddd; +} + +body.light-mode .form-box input::placeholder { + color: #bbb; +} + +body.light-mode .widget { + background-color: #fff; + color: #333; +} + +body.light-mode .widget strong { + color: #1a2332; +} + +body.light-mode .widget p { + color: #555; +} + +body.light-mode .climat { background-color: #e8f4fd; } +body.light-mode .securite { background-color: #f0f0f0; } +body.light-mode .energie { background-color: #fff8e1; } +body.light-mode .lumiere { background-color: #f3e8ff; } + +body.light-mode .graphiques { + background-color: #fff; +} + +body.light-mode .alertes { + background-color: #fdecea; + color: #c0392b; +} + +body.light-mode .logs-container { + background-color: #fff; + color: #333; +} + +body.light-mode .logs-container h2, +body.light-mode .logs-container h3 { + color: #1a2332; +} + +body.light-mode .logs-container ul li { + color: #555; + border-bottom: 1px solid #eee; +} + +body.light-mode footer { + background-color: #f0f2f5; + border-top: 1px solid #ddd; + color: #888; +} + +body.light-mode #toggle-theme { + border-color: #ccd6e0; + color: #ccd6e0; +} + +body.light-mode .profil-info p { + border-bottom: 1px solid #ddd; + color: #555; +} + +body.light-mode .profil-info p strong { + color: #1a2332; +} + +body.light-mode .admin-table th { + background-color: #1a2332; + color: #fff; +} + +body.light-mode .admin-table td { + color: #333; + border-bottom: 1px solid #ddd; +} + +body.light-mode .admin-table tr:hover td { + background-color: #e8f4fd; +} + +body.light-mode .skeleton { + background-color: #ccc; +} + +/* =========================== + RESPONSIVE MOBILE +=========================== */ + +/* Tablette (max 900px) */ +@media (max-width: 900px) { + .dashboard { + grid-template-columns: repeat(2, 1fr); + } + + .graphiques { + grid-column: span 2; + } + + .alertes { + grid-column: span 2; + } + + .cards-home { + grid-template-columns: repeat(2, 1fr); + } +} + +/* Mobile (max 600px) */ +@media (max-width: 600px) { + nav { + padding: 10px 15px; + height: auto; + flex-direction: column; + gap: 10px; + } + + nav ul { + flex-wrap: wrap; + justify-content: center; + gap: 10px; + } + + .dashboard { + grid-template-columns: 1fr; + padding: 10px 15px; + } + + .graphiques { + grid-column: span 1; + } + + .alertes { + grid-column: span 1; + } + + .cards-home { + grid-template-columns: 1fr; + } + + .form-box { + width: 90%; + margin: 30px auto; + } + + .hero { + padding: 40px 15px 30px; + } + + .hero h2 { + font-size: 1.5em; + } + + .logs-container { + margin: 10px 15px; + padding: 15px; + } + + .admin-table { + font-size: 0.8em; + } + + .btn-action { + display: block; + margin-bottom: 5px; + } +} \ No newline at end of file diff --git a/smart-house---final-/test.php b/smart-house---final-/test.php new file mode 100644 index 0000000..b05017c --- /dev/null +++ b/smart-house---final-/test.php @@ -0,0 +1,15 @@ +"; + +echo "Vérification : "; +var_dump(password_verify($password, $users[$username]['password'])); +?> \ No newline at end of file diff --git a/smart-house---final-/users.json.php b/smart-house---final-/users.json.php new file mode 100644 index 0000000..17ea8b6 --- /dev/null +++ b/smart-house---final-/users.json.php @@ -0,0 +1,6 @@ +{ + "Kari": { + "password": "$2y$10$ocJtd5vNxlaQfzBRiueP6.JBNkxNEjh2UviGLXL4aEyXAKuWxBW0.", + "role": "Admin" + } +} \ No newline at end of file