|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <!DOCTYPE html>
- <html lang="fr">
-
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <meta charset="utf-8">
- <title>Allo-GG</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <link rel="stylesheet" href="bootstrap.css" media="screen">
- </head>
-
- <?php
- if (isset($_POST['password']) && $_POST['password'] == '#allogg_psw#') {
-
-
- $etat_status[0]='success';
- $etat_status[1]='light';
-
- $porte_status[0]='info';
- $porte_status[1]='light';
-
- $sonette_status[0]='danger';
- $sonette_status[1]='light';
-
- $sonette_btn[0]='
- <p class="bs-component">
- <a href="index.php?action=sound&msg=2">
- <button type="submit" name="action" class="btn btn-outline-info" id="sound">🔊 Activer la sonette 🔔</button>
- </a>
- </p>
- ';
-
- $sonette_btn[1]='
- <p>
- <a href="index.php?action=mute&msg=3">
- <button type="submit" name="action" class="btn btn-outline-warning" id="mute">🔇 Désactiver la sonette 🔔</button>
- </a>
- </p>
- ';
-
- $message[0]='
- <hr/>
- <div class="alert alert-dismissible alert-danger">
- <button type="button" class="close" data-dismiss="alert">×</button>
- <h4>Erreur !</h4>
- <p>Houston, nous avons un petit problème ...</p>
- </div>
- ';
- $message[1]='
- <hr/>
- <div class="alert alert-dismissible alert-primary">
- <button type="button" class="close" data-dismiss="alert">×</button>
- <h4>La porte est ouverte !</h4>
- <p>YOU SHALL NOT PASS!</p>
- <p>🚪</p>
- </div>
- ';
- $message[2]='
- <hr/>
- <div class="alert alert-dismissible alert-success">
- <button type="button" class="close" data-dismiss="alert">×</button>
- <h4>La sonette est maintenant active !</h4>
- <p>"Dring Dring !"<br/>
- - Oui ?<br/>
- - C\'est "moi", le seul et l\'unique.<br/>
- - ...
- </p>
- <p>🔊</p>
- </div>
- ';
- $message[3]='
- <hr/>
- <div class="alert alert-dismissible alert-success">
- <button type="button" class="close" data-dismiss="alert">×</button>
- <h4>Silence !</h4>
- <p>Hush now! Quiet now!<br/>
- It\'s time to lay your sleepy head!<br/>
- Said hush now! Quiet now!<br/>
- It\'s time to go to bed!</p>
- <p>🔇</p>
- </div>
- ';
- $message[4]='
- <hr/>
- <div class="alert alert-dismissible alert-success">
- <button type="button" class="close" data-dismiss="alert">×</button>
- <h4>Redémarrage en cours ...</h4>
- <p>Oh My Gawd! I\'m a Girl ! And still Not Ginger !</p>
- <p>🔄</p>
- </div>
- ';
- $message[5]='
- <hr/>
- <div class="alert alert-dismissible alert-success">
- <button type="button" class="close" data-dismiss="alert">×</button>
- <h4>Ça va être tout noir !</h4>
- <p>🔌</p>
- </div>
- ';
-
- if ($_GET["action"] == "open")
- {
- exec("../scripts/open.sh > /dev/null &");
- exec("sleep 1");
- }
-
- elseif ($_GET['action'] == "sound")
- {
- exec("../scripts/sound.sh > /dev/null &");
- exec("sleep 1");
- }
-
- elseif ($_GET['action'] == "mute")
- {
- exec("../scripts/mute.sh > /dev/null &");
- exec("sleep 1");
- }
-
- elseif ($_GET['action'] == "reboot")
- {
- exec("../scripts/reboot.sh > /dev/null &");
- }
-
- elseif ($_GET['action'] == "poweroff")
- {
- exec("../scripts/poweroff.sh > /dev/null &");
- }
- ?>
-
- <body>
- <div class="container" style="text-align:center;">
-
- <?php echo $message[$_GET["msg"]]; ?>
-
- <hr/>
- <div class="page-header">
- <div class="row">
- <div class="col-lg-12">
- <a href="index.php"><img src="../logo/allo-gg-logo.png" class="img-fluid" alt="Responsive image"></a>
- <br/><br/>
- </div>
- </div>
- </div>
-
- <h2 class="text-primary">Interface de contrôle du module</h2>
- <?php $etat = exec("/usr/local/bin/gpio -g read 18"); ?>
- <?php $sonette = exec("/usr/local/bin/gpio -g read 17"); ?>
- <?php $porte = exec("/usr/local/bin/gpio -g read 4"); ?>
-
- <span class="badge badge-pill badge-<?php echo $etat_status[$etat]; ?>"> </span>
-
- <span class="badge badge-pill badge-<?php echo $porte_status[$porte]; ?>"> </span>
-
- <span class="badge badge-pill badge-<?php echo $sonette_status[$sonette]; ?>"> </span>
- <hr/>
-
- <div class="row">
- <div class="col-lg-12">
- <p class="bs-component">
- <a href="index.php?action=open&msg=1">
- <button type="submit" name="action" class="btn btn-primary btn-lg" id="open">🚪 <strong>OUVERTURE DE LA PORTE</strong> 🔑</button>
- </a>
- </p>
- <hr/>
-
- <?php echo $sonette_btn[$sonette]; ?>
-
- <hr/>
- <p class="bs-component">
- <a href="index.php?action=reboot&msg=4">
- <button type="submit" name="action" class="btn btn-outline-success" id="update">🔄 Redémarrer ⏻</button>
- </a>
- <a href="index.php?action=poweroff&msg=5">
- <button type="submit" name="action" class="btn btn-outline-danger" id="poweroff">🔌 Éteindre ⚡️</button>
- </a>
- </p>
-
- <hr/>
- <p class="bs-component">
- <a href="check_services.php">
- <button type="button" class="btn btn-outline-secondary" id="log">📜 Journal d'activité 🔍</button>
- </a>
- </p>
- </div>
- <hr/>
- </div>
-
- </div>
-
- <script src="jquery.js"></script>
- <script src="bootstrap.js"></script>
-
- </body>
- </html>
-
- <?php
- }
- else {
- echo '
- <br/><br/><br/><br/>
- <div class="row col-lg-12">
- <div class="col-lg-4"></div>
- <div class="col-lg-4">
- <hr/>
- <form action="" method="post">
- <div class="input-group">
- <div class="input-group-prepend">
- <span class="input-group-text">🔒</span>
- </div>
- <input class="form-control" name="password" placeholder="Mot de passe ..." type="password">
- <button type="submit" class="btn btn-light">🔑 OK</button>
- </div>
- </form>
- <hr/>
- </div>
- <div class="col-lg-4"></div>
- </div>
- ';
- }
- ?>
|