102 lines
3.3 KiB
PHP
Executable File
102 lines
3.3 KiB
PHP
Executable File
<?php
|
|
$page = null;
|
|
if (isset($_GET['p'])) {
|
|
$page = $_GET['p'];
|
|
}
|
|
if (isset($_POST['configfile'])) {
|
|
file_put_contents('config.ini', $_POST['configfile']);
|
|
header('Location: http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);
|
|
}
|
|
?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
|
|
<head>
|
|
<title>Banc Test</title>
|
|
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
|
<meta name="generator" content="Geany 1.36" />
|
|
<style>
|
|
a {
|
|
color: #3E3E7C;
|
|
text-decoration: none;
|
|
}
|
|
#footer {
|
|
position: fixed;
|
|
bottom:0;
|
|
right:0;
|
|
}
|
|
#menu li,
|
|
#footer li {
|
|
margin: 10px;
|
|
display:inline;
|
|
}
|
|
.error {
|
|
color: #B21E1E;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<?php
|
|
$config_rw=true;
|
|
$config = parse_ini_file('config.ini', true);
|
|
if ($config == false) {
|
|
echo '<div class="error">Erreur : Votre fichier config.ini n\'exsite pas ou comporte des erreurs/commentaires non lu par se programme.</div>';
|
|
$page='config';
|
|
} elseif (is_writeable('config.ini')) {
|
|
echo '<div class="error">Erreur : Votre fichier config.ini n\'est pas accessible en écriture, vous ne pourez donc pas l\'éditer par cette interface.</div>';
|
|
$config_rw=false;
|
|
}
|
|
?>
|
|
<h1 id="title">banc-ecs-diehl</h1>
|
|
<div id="menu">
|
|
<ul>
|
|
<li><a href="http://<?= $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'] ?>">Aquisition</a></li>
|
|
<li><a href="http://<?= $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'] ?>?p=config">Editer la configuration</a></li>
|
|
<li><a href="http://<?= $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'] ?>?p=dl">Téléchargement des relevés</a></li>
|
|
</ul>
|
|
</div>
|
|
<?php
|
|
switch ($page) {
|
|
case 'config':
|
|
$content = file_get_contents('config.ini');
|
|
echo '<form action="#" method="post">';
|
|
echo '<p>Avant tout changement de configuration, bien <a href="https://gitlab.lowtech.fr/pdm/projets/labo/pub/banc-tempsurf-ds18b20#configuration">lire la documentation</a> : </p>';
|
|
echo '<p><textarea name="configfile" id="configfile" rows="15" cols="70">'.$content.'</textarea></p>';
|
|
if ($config_rw == true) {
|
|
echo '<p><input type="submit" value="Enregistrer" /></p>';
|
|
} else {
|
|
echo '<p>Le fichier n\'est pas accessible en écriture, il ne peut être enregistré par cette interface.</p>';
|
|
}
|
|
echo '</form>';
|
|
break;
|
|
case 'dl':
|
|
$cdir = scandir($config['general']['csv_dir']);
|
|
echo '<p>Liste le répertoire <i>'.$config['general']['csv_dir'].'</i> : </p>';
|
|
echo '<ul>';
|
|
foreach ($cdir as $value) {
|
|
if (!in_array($value,array(".",".."))) {
|
|
echo '<li><a href="'.$config['general']['csv_dir'].'/'.$value.'">'.$value.'</a></li>';
|
|
}
|
|
}
|
|
echo '</ul>';
|
|
break;
|
|
default:
|
|
?>
|
|
<iframe id="" allowtransparency="true" scrolling="auto" src="http://<?= $_SERVER['SERVER_NAME'] ?>:8022/" style="width:100%;height:300px;border:none;"></iframe>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<div id="footer">
|
|
<ul>
|
|
<!-- <li><a href="https://gitlab.lowtech.fr/pdm/projets/labo/pub/banc-tempsurf-ds18b20">Code source</a></li>-->
|
|
<li>Auteur: <a href="https://david.mercereau.info/contact/">David Mercereau</a></li>
|
|
<li>Licence <a href="https://www.gnu.org/licenses/agpl-3.0.fr.html">AGPL v3</a></li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|