Browse Source

ajout de 'index.php'

master
BOLLET Corentin 1 year ago
parent
commit
e8a8ab3caf
  1. 101
      index.php

101
index.php

@ -0,0 +1,101 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DOMOTOR</title>
<link rel="stylesheet" href="styles.css">
</head>
<?php
//exec('gpio mode 7 out')
//exec('gpio mode 0 out')
//exec('gpio mode 2 out')
//exec('gpio mode 3 out')
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST['lumiere'])) {
$lumiere = $_POST['lumiere'];
if ($lumiere == "Allumer") {
exec('gpio write 7 1');
} else {
exec('gpio write 7 0');
}
}
if (isset($_POST['radiateur'])) {
$chauffage = $_POST['radiateur'];
if ($chauffage == "Allumer") {
exec('gpio write 0 1');
} else {
exec('gpio write 0 0');
}
}
if (isset($_POST['volet'])) {
$volet = $_POST['volet'];
if ($volet == "Ouvrir") {
exec('gpio write 2 1');
sleep(1);
exec('gpio write 2 0');
} else {
exec('gpio write 3 1');
sleep(1);
exec('gpio write 3 0');
}
}
}
?>
<body>
<header>
<div class="header-content">
<h1>DOMOTOR</h1>
<p>Gestionnaire de domotique fiable et sécurisé</p>
</div>
</header>
<main id="main">
<div class="icon">
<img src="https://www.greenwatt.fr/wp-content/uploads/sites/94/2022/02/radiateur-basse-temperature.jpg" alt="Radiateur">
<div class="buttons">
<form method="post" action="">
<?php
exec('gpio read 0',$radiateur_est_allume);
$radiateur_est_allume = implode("", $radiateur_est_allume);
if ($radiateur_est_allume == 1) {
echo '<input type="submit" name="radiateur" value="Éteindre">';
} else {
echo '<input type="submit" name="radiateur" value="Allumer">';
}?>
</form>
</div>
</div>
<div class="icon">
<img src="https://www.voletshop.fr/52430-large_default/Volet-roulant-renovation-manuel.jpg" alt="Volet roulant">
<div class="buttons">
<form method="post" action="">
<input type="submit" name="volet" value="Fermer" onclick="document.getElementById('chargement_fermeture_volet').style.display = 'block';document.getElementById('main').style.opacity = '0.5';">
<input type="submit" name="volet" value="Ouvrir" onclick="document.getElementById('chargement_ouverture_volet').style.display = 'block';document.getElementById('main').style.opacity = '0.5';">
</form>
</div>
</div>
<div class="icon">
<img src="https://www.pro-illumination.fr/img/p/1/5/6/2/1/15621.jpg" alt="Ampoule">
<div class="buttons">
<form method="post" action="">
<?php exec('gpio read 7',$rlumiere_est_allume);
$lumiere_est_allume = implode("", $rlumiere_est_allume);
if ($lumiere_est_allume == 1) {
echo '<input type="submit" name="lumiere" value="Éteindre">';
} else {
echo '<input type="submit" name="lumiere" value="Allumer">';
}?>
</form>
</div>
</div>
</main>
<div id="chargement_ouverture_volet" class="chargement">
<p>Ouverture en cours...</p>
</div>
<div id="chargement_fermeture_volet" class="chargement">
<p>Fermeture en cours...</p>
</div>
</body>
</html>
Loading…
Cancel
Save