Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

214 linhas
5.8 KiB

  1. <!DOCTYPE html>
  2. <html lang="fr">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <meta charset="utf-8">
  6. <title>Allo-GG</title>
  7. <meta name="viewport" content="width=device-width, initial-scale=1">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <link rel="stylesheet" href="bootstrap.css" media="screen">
  10. </head>
  11. <?php
  12. if (isset($_POST['password']) && $_POST['password'] == 'heuzef') {
  13. $etat_status[0]='success';
  14. $etat_status[1]='light';
  15. $porte_status[0]='info';
  16. $porte_status[1]='light';
  17. $sonette_status[0]='danger';
  18. $sonette_status[1]='light';
  19. $sonette_btn[0]='
  20. <p class="bs-component">
  21. <a href="index.php?action=sound&msg=2">
  22. <button type="submit" name="action" class="btn btn-outline-info" id="sound">🔊 Activer la sonette 🔔</button>
  23. </a>
  24. </p>
  25. ';
  26. $sonette_btn[1]='
  27. <p>
  28. <a href="index.php?action=mute&msg=3">
  29. <button type="submit" name="action" class="btn btn-outline-warning" id="mute">🔇 Désactiver la sonette 🔔</button>
  30. </a>
  31. </p>
  32. ';
  33. $message[0]='
  34. <hr/>
  35. <div class="alert alert-dismissible alert-danger">
  36. <button type="button" class="close" data-dismiss="alert">&times;</button>
  37. <h4>Erreur !</h4>
  38. <p>Houston, nous avons un petit problème ...</p>
  39. </div>
  40. ';
  41. $message[1]='
  42. <hr/>
  43. <div class="alert alert-dismissible alert-primary">
  44. <button type="button" class="close" data-dismiss="alert">&times;</button>
  45. <h4>La porte est ouverte !</h4>
  46. <p>YOU SHALL NOT PASS!</p>
  47. <p>🚪</p>
  48. </div>
  49. ';
  50. $message[2]='
  51. <hr/>
  52. <div class="alert alert-dismissible alert-success">
  53. <button type="button" class="close" data-dismiss="alert">&times;</button>
  54. <h4>La sonette est maintenant active !</h4>
  55. <p>"Dring Dring !"<br/>
  56. - Oui ?<br/>
  57. - C\'est "moi", le seul et l\'unique.<br/>
  58. - ...
  59. </p>
  60. <p>🔊</p>
  61. </div>
  62. ';
  63. $message[3]='
  64. <hr/>
  65. <div class="alert alert-dismissible alert-success">
  66. <button type="button" class="close" data-dismiss="alert">&times;</button>
  67. <h4>Silence !</h4>
  68. <p>Hush now! Quiet now!<br/>
  69. It\'s time to lay your sleepy head!<br/>
  70. Said hush now! Quiet now!<br/>
  71. It\'s time to go to bed!</p>
  72. <p>🔇</p>
  73. </div>
  74. ';
  75. $message[4]='
  76. <hr/>
  77. <div class="alert alert-dismissible alert-success">
  78. <button type="button" class="close" data-dismiss="alert">&times;</button>
  79. <h4>Redémarrage en cours ...</h4>
  80. <p>Oh My Gawd! I\'m a Girl ! And still Not Ginger !</p>
  81. <p>🔄</p>
  82. </div>
  83. ';
  84. $message[5]='
  85. <hr/>
  86. <div class="alert alert-dismissible alert-success">
  87. <button type="button" class="close" data-dismiss="alert">&times;</button>
  88. <h4>Ça va être tout noir !</h4>
  89. <p>🔌</p>
  90. </div>
  91. ';
  92. if ($_GET["action"] == "open")
  93. {
  94. exec("../scripts/open.sh > /dev/null &");
  95. exec("sleep 1");
  96. }
  97. elseif ($_GET['action'] == "sound")
  98. {
  99. exec("../scripts/sound.sh > /dev/null &");
  100. exec("sleep 1");
  101. }
  102. elseif ($_GET['action'] == "mute")
  103. {
  104. exec("../scripts/mute.sh > /dev/null &");
  105. exec("sleep 1");
  106. }
  107. elseif ($_GET['action'] == "reboot")
  108. {
  109. exec("../scripts/reboot.sh > /dev/null &");
  110. }
  111. elseif ($_GET['action'] == "poweroff")
  112. {
  113. exec("../scripts/poweroff.sh > /dev/null &");
  114. }
  115. ?>
  116. <body>
  117. <div class="container" style="text-align:center;">
  118. <?php echo $message[$_GET["msg"]]; ?>
  119. <hr/>
  120. <div class="page-header">
  121. <div class="row">
  122. <div class="col-lg-12">
  123. <a href="index.php"><img src="../logo/allo-gg-logo.png" class="img-fluid" alt="Responsive image"></a>
  124. <br/><br/>
  125. </div>
  126. </div>
  127. </div>
  128. <h2 class="text-primary">Interface de contrôle du module</h2>
  129. <?php $etat = exec("/usr/local/bin/gpio -g read 18"); ?>
  130. <?php $sonette = exec("/usr/local/bin/gpio -g read 17"); ?>
  131. <?php $porte = exec("/usr/local/bin/gpio -g read 4"); ?>
  132. <a href="check_services.php"><span class="badge badge-pill badge-<?php echo $etat_status[$etat]; ?>">&nbsp;</span></a>
  133. &nbsp;
  134. <span class="badge badge-pill badge-<?php echo $porte_status[$porte]; ?>">&nbsp;</span>
  135. &nbsp;
  136. <span class="badge badge-pill badge-<?php echo $sonette_status[$sonette]; ?>">&nbsp;</span>
  137. <hr/>
  138. <div class="row">
  139. <div class="col-lg-12">
  140. <p class="bs-component">
  141. <a href="index.php?action=open&msg=1">
  142. <button type="submit" name="action" class="btn btn-primary btn-lg" id="open">🚪 <strong>OUVERTURE DE LA PORTE</strong> 🔑</button>
  143. </a>
  144. </p>
  145. <hr/>
  146. <?php echo $sonette_btn[$sonette]; ?>
  147. <hr/>
  148. <p class="bs-component">
  149. <a href="index.php?action=reboot&msg=4">
  150. <button type="submit" name="action" name="actions" class="btn btn-outline-success" id="update">🔄 Redémarrer ⏻</button>
  151. </a>
  152. <a href="index.php?action=poweroff&msg=5">
  153. <button type="submit" name="action" class="btn btn-outline-danger" id="poweroff">🔌 Éteindre ⚡️</button>
  154. </a>
  155. </div>
  156. <hr/>
  157. </div>
  158. </div>
  159. <script src="jquery.js"></script>
  160. <script src="bootstrap.js"></script>
  161. </body>
  162. </html>
  163. <?php
  164. }
  165. else {
  166. echo '
  167. <br/><br/><br/><br/>
  168. <div class="row col-lg-12">
  169. <div class="col-lg-4"></div>
  170. <div class="col-lg-4">
  171. <hr/>
  172. <form action="" method="post">
  173. <div class="input-group">
  174. <div class="input-group-prepend">
  175. <span class="input-group-text">🔒</span>
  176. </div>
  177. <input class="form-control" name="password" placeholder="Mot de passe ..." type="password">
  178. &nbsp;&nbsp;<button type="submit" class="btn btn-light">🔑 OK</button>
  179. </div>
  180. </form>
  181. <hr/>
  182. </div>
  183. <div class="col-lg-4"></div>
  184. </div>
  185. ';
  186. }
  187. ?>