Browse Source

Mise en place de la premiere version stable du programme

master
heuzef 6 years ago
parent
commit
c26f53e2e8
10 changed files with 131 additions and 36 deletions
  1. +5
    -0
      install.sh
  2. +3
    -0
      scripts/boot.sh
  3. +3
    -0
      scripts/mute.sh
  4. +0
    -0
      scripts/open.sh
  5. +4
    -0
      scripts/reboot.sh
  6. +3
    -0
      scripts/sound.sh
  7. +2
    -0
      scripts/test.sh
  8. +3
    -0
      scripts/update.sh
  9. +0
    -28
      ui/actions.php
  10. +108
    -8
      ui/index.php

+ 5
- 0
install.sh View File

@@ -0,0 +1,5 @@
#!/bin/bash
# Allo-GG
# Installation de Allo-GG sur un Pi Zero avec Rasbian.

chmod -R +x scripts/

+ 3
- 0
scripts/boot.sh View File

@@ -0,0 +1,3 @@
#!/bin/bash
# Allo-GG
# Demarrage du module

+ 3
- 0
scripts/mute.sh View File

@@ -0,0 +1,3 @@
#!/bin/bash
# Allo-GG
# Mise en sourdine de la sonnette

+ 0
- 0
scripts/open.sh View File


+ 4
- 0
scripts/reboot.sh View File

@@ -0,0 +1,4 @@
#!/bin/bash
# Allo-GG
# Redemarrage du module
reboot

+ 3
- 0
scripts/sound.sh View File

@@ -0,0 +1,3 @@
#!/bin/bash
# Allo-GG
# Allumage de la sonnette

+ 2
- 0
scripts/test.sh View File

@@ -0,0 +1,2 @@
#!/bin/bash
echo "Execution du script test.sh avec succes 👍"

+ 3
- 0
scripts/update.sh View File

@@ -0,0 +1,3 @@
#!/bin/bash
# Allo-GG
# Mise a jour du module

+ 0
- 28
ui/actions.php View File

@@ -1,28 +0,0 @@
<?php
if ($_POST['action'] == 'OPEN')
{
system("/bin/bash ../scripts/open.sh");
}

elseif ($_POST['action'] == 'MUTE')
{
echo "MUTE";
}

elseif ($_POST['action'] == 'UPDATE')
{
echo "UPDATE";
}

elseif ($_POST['action'] == 'REBOOT')
{
echo "REBOOT";
}

else
{
echo "ERREUR";
}

header('Location: index.php');
?>

+ 108
- 8
ui/index.php View File

@@ -10,41 +10,114 @@
<link rel="stylesheet" href="bootstrap.css" media="screen">
</head>

<?php
if (isset($_POST['password']) && $_POST['password'] == 'ogg') {

$message[0]='
<hr/>
<div class="alert alert-dismissible alert-danger">
<button type="button" class="close" data-dismiss="alert">&times;</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">&times;</button>
<h4>YOU SHALL NOT PASS !</h4>
<p>La porte est ouverte ! ✌️</p>
</div>
';
$message[2]='
<hr/>
<div class="alert alert-dismissible alert-success">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4>SUCCESS !</h4>
<p>👍</p>
</div>
';

if ($_GET["action"] == "test")
{
$test = exec("/bin/bash ../scripts/test.sh");
echo "<pre>$test</pre>";
}

elseif ($_GET["action"] == "open")
{
exec("../scripts/open.sh");
}

elseif ($_GET['action'] == "sound")
{
exec("../scripts/sound.sh");
}

elseif ($_GET['action'] == "mute")
{
exec("../scripts/mute.sh");
}

elseif ($_GET['action'] == "update")
{
exec("../scripts/update.sh");
}

elseif ($_GET['action'] == "reboot")
{
exec("../scripts/reboot.sh");
}
?>

<body>
<div class="container" style="text-align:center;">
<hr/>

<?php echo $message[$_GET["msg"]]; ?>

<hr/>
<div class="page-header">
<div class="row">
<div class="col-lg-12">
<img src="../logo/allo-gg-logo.png" class="img-fluid" alt="Responsive image">
<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>
<a href="index.php?action=test">Executer le script test.sh ✔️</a>
<hr/>

<div class="row">
<div class="col-lg-12">
<form action="actions.php" method="post">
<p class="bs-component">
<button type="submit" name="action" class="btn btn-primary btn-lg" id="OPEN">🚪 <strong>OUVERTURE DE LA PORTE</strong> 🔑</button>
<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/>
<p class="bs-component">
<button type="submit" name="action" class="btn btn-outline-warning" id="MUTE">🔇 Éteindre la sonette 🔔</button> pour 1 Heure ...
<a href="index.php?action=sound&msg=2">
<button type="submit" name="action" class="btn btn-outline-info" id="sound">🔊 Allumer la sonette 🔔</button>
</a>

<a href="index.php?action=mute&msg=2">
<button type="submit" name="action" class="btn btn-outline-warning" id="mute">🔇 Éteindre la sonette 🔔</button>
</a>
</p>
<hr/>
<p class="bs-component">
<button type="submit" name="action" name="actions" class="btn btn-outline-success" id="UPDATE">🔄 Mettre à jour le module 🔍</button>
<a href="index.php?action=update&msg=2">
<button type="submit" name="action" name="actions" class="btn btn-outline-success" id="update">🔄 Mettre à jour le module 🔍</button>
</a>
</p>
<hr/>
<p class="bs-component">
<button type="submit" name="action" class="btn btn-outline-danger" id="REBOOT">⚡️ Redémarrer le module 🔌</button>
<a href="index.php?action=reboot&msg=2">
<button type="submit" name="action" class="btn btn-outline-danger" id="reboot">⚡️ Redémarrer le module 🔌</button>
</a>
</p>
</form>
</div>
<hr/>
</div>
@@ -56,3 +129,30 @@

</body>
</html>

<?php
}
else {
echo '
<p class="text-muted"><em>🔓 La réponse pour mon Gégé :</em> <span class="badge badge-pill badge-secondary">ogg</span></p>
<br/><br/><br/><br/>
<div class="row">
<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">
&nbsp;&nbsp;<button type="submit" class="btn btn-light">🔑 OK</button>
</div>
</form>
<hr/>
</div>
<div class="col-lg-4"></div>
</div>
';
}
?>

Loading…
Cancel
Save