File "gestion_systeme.php"
Full Path: /home/analogde/www/XTRAIL/WORKAREA/Upload_code/Transfert/gestion_systeme.php
File size: 3.97 KB
MIME-type: text/x-php
Charset: utf-8
<?php
session_start();
error_reporting(0);
if($_SESSION['logged']== "no")
{
header ('Location: interdiction.php');
}
/* empecher le rechargement intempestif de la page */
if(!empty($_POST) )
{
$_SESSION['sauvegarde_formulaire'] = $_POST ;
$page_actuelle = $_SERVER['PHP_SELF'] ;
if(!empty($_SERVER['QUERY_STRING']))
{
$page_actuelle .= '?' . $_SERVER['QUERY_STRING'] ;
}
header('Location: ' . $page_actuelle);
exit;
}
if(isset($_SESSION['sauvegarde_formulaire']))
{
$_POST = $_SESSION['sauvegarde_formulaire'] ;
unset($_SESSION['sauvegarde_formulaire']);
}
/***********************************************************/
//echo "Salut les affreux !!!";
$user = "root";
$password = "rainbow";
$host = "localhost";
$db = "raspberry";
$db_connection = mysql_connect($host, $user, $password);
mysql_select_db($db, $db_connection);
/* lire le fichier qui mémorise l'état de l'alarme */
$fp = fopen ("status.txt", "r+"); /* lecture + ecriture */
$status_alarme = fgets($fp);
fclose ($fp);
/*if(!empty($_POST['Capture']) )
{
//header(location:'bifou.php');
toto = 5;
} */
if(isset($_POST['Capture']))
{
//header('location: test_redirection.php');
$infos = date('d-m-Y__H:i:s');
$fichier = "snapshot_" .$infos .".jpeg";
$cmd = "sudo raspistill -w 640 -h 480 -o " .$fichier;
//echo $cmd;
system($cmd);
//system('sudo raspistill -o saturday.jpeg');
$affiche_message = "OK";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gestion du systéme</title>
<link rel="shortcut icon" href="images/alarm.ico" type="image/x-icon" />
</head>
<script type="text/javascript">
function SoumettreFormulaire(){
/* if (confirm ('Voulez vous vraiment valider le formulaire ? ')){
document.forms["mon_formulaire"].submit();
}*/
document.forms["formulaire"].submit();
}
</script>
<body>
<table width="515" border="1">
<tr>
<th width="18" scope="col">GPIO #</th>
<th width="56" scope="col">Description</th>
<th width="24" scope="col">Statut</th>
</tr>
<tr>
<td align="center">Wpi 29</td>
<!-- <td> </td> -->
<?php
if($status_alarme == 'off')
{
echo '<td id ="etat" align="center">Inactive</td>';
echo '<td align="center"><img id="button1" src="images/off.jpg" width="100" height="100" alt="off" title="off" /></td>';
}
else
{
echo '<td id ="etat" align="center">En marche</td>';
echo '<td align="center"><img id="button1" src="images/on.jpg" width="100" height="100" alt="on" title="on" /></td>';
}
?>
</tr>
</table>
<form name="formulaire" action = "gestion_systeme.php" method = "post">
<!--<input type = "submit" name = "Capture" value = "Capture" >-->
<input type="image" src="images/nikon.png" width="64" height="64" alt="image" title ="Prendre une photo" onclick="SoumettreFormulaire();" >
<input type='hidden' name ="Capture" value="Capture">
</form>
<?php
//if($_SESSION['message'] == "ok")
//{ echo '<div id="message_traitement" style="display:block">Votre nouveau password viens d\'être pris en compte par le serveur.</div>';
// $_SESSION['message'] = "none";
//}
if($affiche_message == "OK")
{
echo "Acquisition faite: " .$fichier;
$affiche_message = "none";
}
echo "<br><br>";
?>
<a href="galerie.php">Visualiser les snapshots ...</a>
<br>
<br>
<a href="voir_alarm_activation.php">Voir les activations ...</a>
<br>
<br>
<a href="camera.php">Camera</a>
<br>
<br>
<a href="start_video.php">Lancer le mode video ...</a>
<br>
<br>
<a href="stop_video.php">stopper le mode video ...</a>
<br>
<br>
<a href="voir_alarm_event.php">Voir les événements ...</a>
<br>
<br>
<a href="password.php">Changer code d'accés ...</a>
<br>
<br>
<a href="logout.php">Deconnexion ...</a>
<script src="script.js"></script>
</body>
</html>