Refactor code for improved readability and consistency across multiple files
This commit is contained in:
66
alertes.php
66
alertes.php
@ -1,6 +1,5 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['droit'] > 0)
|
if (@$infos_user['droit'] > 0) {
|
||||||
{
|
|
||||||
|
|
||||||
$color = true;
|
$color = true;
|
||||||
$num_page = 1; // Initialisation du numéro de la page
|
$num_page = 1; // Initialisation du numéro de la page
|
||||||
@ -12,49 +11,45 @@ if(isset($_GET['npp']) && $_GET['npp'] > 0)
|
|||||||
$nb_per_page = $_GET['npp']; // On modifie l'attribut
|
$nb_per_page = $_GET['npp']; // On modifie l'attribut
|
||||||
|
|
||||||
// Si le numéro de la page est supérieur à 0
|
// Si le numéro de la page est supérieur à 0
|
||||||
if(isset($_GET['page']) && $_GET['page'] > 0)
|
if (isset($_GET['page']) && $_GET['page'] > 0) {
|
||||||
{
|
|
||||||
$num_page = $_GET['page']; // On modifie l'attribut
|
$num_page = $_GET['page']; // On modifie l'attribut
|
||||||
$index = $nb_per_page * ($num_page - 1); // Ainsi que l'attribut ci
|
$index = $nb_per_page * ($num_page - 1); // Ainsi que l'attribut ci
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sélection de l'affichage
|
// Sélection de l'affichage
|
||||||
$getaff = "";
|
$getaff = "";
|
||||||
if(isset($_POST['chateau']) or isset($_POST['relevage']) or isset($_POST['surpresseur']))
|
if (isset($_POST['chateau']) or isset($_POST['relevage']) or isset($_POST['surpresseur'])) {
|
||||||
{
|
if (@$_POST['chateau']) $_SESSION['alerte_chateau'] = 1;
|
||||||
if(@$_POST['chateau']) $_SESSION['alerte_chateau'] = 1; else $_SESSION['alerte_chateau'] = 0;
|
else $_SESSION['alerte_chateau'] = 0;
|
||||||
if(@$_POST['relevage']) $_SESSION['alerte_relevage'] = 1; else $_SESSION['alerte_relevage'] = 0;
|
if (@$_POST['relevage']) $_SESSION['alerte_relevage'] = 1;
|
||||||
if(@$_POST['surpresseur']) $_SESSION['alerte_surpresseur'] = 1; else $_SESSION['alerte_surpresseur'] = 0;
|
else $_SESSION['alerte_relevage'] = 0;
|
||||||
|
if (@$_POST['surpresseur']) $_SESSION['alerte_surpresseur'] = 1;
|
||||||
|
else $_SESSION['alerte_surpresseur'] = 0;
|
||||||
}
|
}
|
||||||
if(!@$_SESSION['alerte_chateau'] && !@$_SESSION['alerte_relevage'] && !@$_SESSION['alerte_surpresseur'])
|
if (!@$_SESSION['alerte_chateau'] && !@$_SESSION['alerte_relevage'] && !@$_SESSION['alerte_surpresseur']) {
|
||||||
{
|
|
||||||
$_SESSION['alerte_chateau'] = 1;
|
$_SESSION['alerte_chateau'] = 1;
|
||||||
$_SESSION['alerte_relevage'] = 1;
|
$_SESSION['alerte_relevage'] = 1;
|
||||||
$_SESSION['alerte_surpresseur'] = 1;
|
$_SESSION['alerte_surpresseur'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$where = "WHERE ";
|
$where = "WHERE ";
|
||||||
if($_SESSION['alerte_chateau'])
|
if ($_SESSION['alerte_chateau']) {
|
||||||
{ $where .= "equipement='Chateau'"; }
|
$where .= "equipement='Chateau'";
|
||||||
if($_SESSION['alerte_relevage'])
|
}
|
||||||
{
|
if ($_SESSION['alerte_relevage']) {
|
||||||
if ($_SESSION['alerte_chateau']) $where .= " or ";
|
if ($_SESSION['alerte_chateau']) $where .= " or ";
|
||||||
$where .= "equipement='Station de Relevage'";
|
$where .= "equipement='Station de Relevage'";
|
||||||
}
|
}
|
||||||
if($_SESSION['alerte_surpresseur'])
|
if ($_SESSION['alerte_surpresseur']) {
|
||||||
{
|
|
||||||
if ($_SESSION['alerte_relevage'] or $_SESSION['alerte_chateau']) $where .= " or ";
|
if ($_SESSION['alerte_relevage'] or $_SESSION['alerte_chateau']) $where .= " or ";
|
||||||
$where .= "equipement='Surpresseur'";
|
$where .= "equipement='Surpresseur'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_GET['acquitte_id']) && $_GET['acquitte_id'] >= 0)
|
if (isset($_GET['acquitte_id']) && $_GET['acquitte_id'] >= 0) {
|
||||||
{
|
|
||||||
if ($connexion->query("UPDATE alertes SET acquitte='1' WHERE id_releve=" . $_GET['acquitte_id']))
|
if ($connexion->query("UPDATE alertes SET acquitte='1' WHERE id_releve=" . $_GET['acquitte_id']))
|
||||||
header("Location:" . $_SERVER['HTTP_REFERER']); // On acquitte l'alerte avec l'ID $_GET['acquitte_id'] puis on revient
|
header("Location:" . $_SERVER['HTTP_REFERER']); // On acquitte l'alerte avec l'ID $_GET['acquitte_id'] puis on revient
|
||||||
else echo 'Erreur..'; // sur la page précédente donc la page d'affichage des alertes
|
else echo 'Erreur..'; // sur la page précédente donc la page d'affichage des alertes
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
// Requête qui récupère les informations de la base de données
|
// Requête qui récupère les informations de la base de données
|
||||||
$result_alertes = $connexion->query("SELECT * FROM alertes " . $where . " ORDER BY date DESC, heure DESC LIMIT $index, $nb_per_page");
|
$result_alertes = $connexion->query("SELECT * FROM alertes " . $where . " ORDER BY date DESC, heure DESC LIMIT $index, $nb_per_page");
|
||||||
@ -73,7 +68,8 @@ echo '</tr>';
|
|||||||
while ($alertes = $result_alertes->fetch()) // fetch() récupère un à un les alertes
|
while ($alertes = $result_alertes->fetch()) // fetch() récupère un à un les alertes
|
||||||
{
|
{
|
||||||
$color = !$color; // $color est un booléen, pour l'alternance de couleur
|
$color = !$color; // $color est un booléen, pour l'alternance de couleur
|
||||||
if($color) $couleur = "#9CF"; else $couleur = "#9CC"; // 2 couleurs, pour la lisibilité du tableau
|
if ($color) $couleur = "#9CF";
|
||||||
|
else $couleur = "#9CC"; // 2 couleurs, pour la lisibilité du tableau
|
||||||
|
|
||||||
echo '<tr style="background-color:' . $couleur . ';">'; // On défini la nouvelle ligne avec la couleur
|
echo '<tr style="background-color:' . $couleur . ';">'; // On défini la nouvelle ligne avec la couleur
|
||||||
echo '<td class="ligne">' . $alertes['equipement'] . '</td>'; // Equipement
|
echo '<td class="ligne">' . $alertes['equipement'] . '</td>'; // Equipement
|
||||||
@ -93,24 +89,22 @@ echo '</table>'; // Fermeture du tableau
|
|||||||
// Nb pages
|
// Nb pages
|
||||||
$nb_alertes = $connexion->query("SELECT count(*) FROM alertes " . $where . "")->fetchColumn();
|
$nb_alertes = $connexion->query("SELECT count(*) FROM alertes " . $where . "")->fetchColumn();
|
||||||
if ($nb_alertes == 0) echo '<h1>Aucunes alertes</h1>';
|
if ($nb_alertes == 0) echo '<h1>Aucunes alertes</h1>';
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (isset($_GET['page']))
|
if (isset($_GET['page']))
|
||||||
$pageActuelle = $_GET['page'];
|
$pageActuelle = $_GET['page'];
|
||||||
else
|
else
|
||||||
$pageActuelle = '1';
|
$pageActuelle = '1';
|
||||||
|
|
||||||
function get_list_page($page, $nb_page, $link, $nb = 3){
|
function get_list_page($page, $nb_page, $link, $nb = 3)
|
||||||
|
{
|
||||||
$list_page = array();
|
$list_page = array();
|
||||||
for ($i=1; $i <= $nb_page; $i++)
|
for ($i = 1; $i <= $nb_page; $i++) {
|
||||||
{
|
if (($i < $nb) or ($i > $nb_page - $nb) or (($i < $page + $nb) and ($i > $page - $nb)))
|
||||||
if (($i < $nb) OR ($i > $nb_page - $nb) OR (($i < $page + $nb) AND ($i > $page -$nb)))
|
|
||||||
$list_page[] = ($i == $page) ? '<a class="pagenumeroactuel">[ ' . $i . ' ]</a>' : '<a class="pagenumero" href="' . $link . 'page=' . $i . '">' . $i . '</a>';
|
$list_page[] = ($i == $page) ? '<a class="pagenumeroactuel">[ ' . $i . ' ]</a>' : '<a class="pagenumero" href="' . $link . 'page=' . $i . '">' . $i . '</a>';
|
||||||
else
|
else {
|
||||||
{
|
if ($i >= $nb and $i <= $page - $nb)
|
||||||
if ($i >= $nb AND $i <= $page - $nb)
|
|
||||||
$i = $page - $nb;
|
$i = $page - $nb;
|
||||||
elseif ($i >= $page + $nb AND $i <= $nb_page - $nb)
|
elseif ($i >= $page + $nb and $i <= $nb_page - $nb)
|
||||||
$i = $nb_page - $nb;
|
$i = $nb_page - $nb;
|
||||||
$list_page[] = '...';
|
$list_page[] = '...';
|
||||||
}
|
}
|
||||||
@ -137,7 +131,5 @@ echo '>Station de Relevage</label> <label><input type="checkbox" name="surpresse
|
|||||||
if ($_SESSION['alerte_surpresseur']) echo 'checked';
|
if ($_SESSION['alerte_surpresseur']) echo 'checked';
|
||||||
echo '>Surpresseur</label><br/><input type="submit" value="Flitrer les résultats"></form></div>';
|
echo '>Surpresseur</label><br/><input type="submit" value="Flitrer les résultats"></form></div>';
|
||||||
}
|
}
|
||||||
|
} else echo 'Vous n\'êtes pas autorisé/connecté!';
|
||||||
}
|
include('foot.php');
|
||||||
else echo 'Vous n\'êtes pas autorisé/connecté!';
|
|
||||||
include('foot.php'); ?>
|
|
||||||
|
@ -158,13 +158,11 @@ function ds_sh(t) {
|
|||||||
ds_element = t;
|
ds_element = t;
|
||||||
var date = t.value.split("-");
|
var date = t.value.split("-");
|
||||||
// Make a new date, and set the current month and year.
|
// Make a new date, and set the current month and year.
|
||||||
if(t != "")
|
if (t != "") {
|
||||||
{
|
|
||||||
ds_c_month = date[1];
|
ds_c_month = date[1];
|
||||||
ds_c_year = date[0];
|
ds_c_year = date[0];
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
var ds_sh_date = new Date();
|
var ds_sh_date = new Date();
|
||||||
ds_c_month = ds_sh_date.getMonth() + 1;
|
ds_c_month = ds_sh_date.getMonth() + 1;
|
||||||
ds_c_year = ds_sh_date.getFullYear();
|
ds_c_year = ds_sh_date.getFullYear();
|
||||||
|
@ -1,43 +1,29 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['token'] == @$_SESSION['token'] && @$_SESSION['token'] != '')
|
if (@$infos_user['token'] == @$_SESSION['token'] && @$_SESSION['token'] != '') {
|
||||||
{
|
if (@$_GET['action'] == 'logout') {
|
||||||
if(@$_GET['action'] == 'logout')
|
|
||||||
{
|
|
||||||
$_SESSION['user'] = '';
|
$_SESSION['user'] = '';
|
||||||
$_SESSION['token'] = '';
|
$_SESSION['token'] = '';
|
||||||
header('Refresh:1; url=connexion.php');
|
header('Refresh:1; url=connexion.php');
|
||||||
echo 'Vous êtes déconnecté!';
|
echo 'Vous êtes déconnecté!';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
header('Refresh:1; url=index.php');
|
header('Refresh:1; url=index.php');
|
||||||
echo 'Vous êtes connecté en tant que: <b>' . $_SESSION['user'] . '</b>';
|
echo 'Vous êtes connecté en tant que: <b>' . $_SESSION['user'] . '</b>';
|
||||||
}
|
}
|
||||||
}
|
} elseif (@$_POST['user'] && @$_POST['pass']) {
|
||||||
elseif(@$_POST['user'] && @$_POST['pass'])
|
if ($result_infos_userCO = $connexion->query("SELECT * FROM comptes WHERE pseudo='" . $_POST['user'] . "'")) {
|
||||||
{
|
|
||||||
if($result_infos_userCO = $connexion->query("SELECT * FROM comptes WHERE pseudo='".$_POST['user']."'"))
|
|
||||||
{
|
|
||||||
$infos_userCO = $result_infos_userCO->fetch();
|
$infos_userCO = $result_infos_userCO->fetch();
|
||||||
//if($infos_userCO['mdp1'] == md5($_POST['pass']))
|
//if($infos_userCO['mdp1'] == md5($_POST['pass']))
|
||||||
if($infos_userCO['mdp1'] == $_POST['pass'])
|
if ($infos_userCO['mdp1'] == $_POST['pass']) {
|
||||||
{
|
|
||||||
$tokenCO = rand(100000, 999999);
|
$tokenCO = rand(100000, 999999);
|
||||||
if($connexion->query("UPDATE comptes SET token='".$tokenCO."' WHERE pseudo='".$_POST['user']."'"))
|
if ($connexion->query("UPDATE comptes SET token='" . $tokenCO . "' WHERE pseudo='" . $_POST['user'] . "'")) {
|
||||||
{
|
|
||||||
$_SESSION['user'] = $_POST['user'];
|
$_SESSION['user'] = $_POST['user'];
|
||||||
$_SESSION['token'] = $tokenCO;
|
$_SESSION['token'] = $tokenCO;
|
||||||
header('Refresh:1; url=index.php');
|
header('Refresh:1; url=index.php');
|
||||||
echo 'Vous êtes connecté en tant que: <b>' . $_SESSION['user'] . '</b>';
|
echo 'Vous êtes connecté en tant que: <b>' . $_SESSION['user'] . '</b>';
|
||||||
}
|
} else echo 'Erreur avec la BDD! 0x02';
|
||||||
else echo 'Erreur avec la BDD! 0x02';
|
} else echo 'L\'utilisateur ou mot de passe incorrect!<br/><br/>-> <a href="connexion.php">On réésaye?</a>';
|
||||||
}
|
} else echo 'Erreur avec la BDD! 0x01';
|
||||||
else echo 'L\'utilisateur ou mot de passe incorrect!<br/><br/>-> <a href="connexion.php">On réésaye?</a>';
|
} else {
|
||||||
}
|
|
||||||
else echo 'Erreur avec la BDD! 0x01';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<h2>Connexion</h2>
|
<h2>Connexion</h2>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
// message d'erreur lors d'un pb de connexion
|
// message d'erreur lors d'un pb de connexion
|
||||||
// cr<63><72> en 2014 COPYRIGHT<48> C HANRION 2014
|
// cr<63><72> en 2014 COPYRIGHT<48> C HANRION 2014
|
||||||
echo 'Vous n\'etes pas autorise!';
|
echo 'Vous n\'etes pas autorise!';
|
||||||
|
|
||||||
?>
|
|
4
foot.php
4
foot.php
@ -2,7 +2,8 @@
|
|||||||
<!-- FIN CORPS -->
|
<!-- FIN CORPS -->
|
||||||
|
|
||||||
<!-- PIED -->
|
<!-- PIED -->
|
||||||
<div><hr style="width:800px; margin-top:20px;">
|
<div>
|
||||||
|
<hr style="width:800px; margin-top:20px;">
|
||||||
<em style="font-size:12px;">Exécuté en ~<?php
|
<em style="font-size:12px;">Exécuté en ~<?php
|
||||||
list($usec, $sec) = explode(" ", microtime());
|
list($usec, $sec) = explode(" ", microtime());
|
||||||
$fin_ex = (float)$usec + (float)$sec;
|
$fin_ex = (float)$usec + (float)$sec;
|
||||||
@ -13,4 +14,5 @@ echo round($fin_ex-$debut_ex,3);
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -1,4 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Volume Chateau</title>
|
<title>Volume Chateau</title>
|
||||||
@ -19,14 +20,10 @@ $( "#datepicker" ).datepicker( "option", "dateFormat", $( this ).val() );
|
|||||||
</head>
|
</head>
|
||||||
<?php
|
<?php
|
||||||
include('sql_connexion.php');
|
include('sql_connexion.php');
|
||||||
if (isset($_SESSION['pseudo']) && isset($_SESSION['token']))
|
if (isset($_SESSION['pseudo']) && isset($_SESSION['token'])) {
|
||||||
{
|
if (isset($_GET['datepicker'])) {
|
||||||
if(isset ($_GET['datepicker']))
|
|
||||||
{
|
|
||||||
$datepicker = $_GET['datepicker'];
|
$datepicker = $_GET['datepicker'];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$datepicker = null;
|
$datepicker = null;
|
||||||
}
|
}
|
||||||
echo '<form name=\'form\' method=\'get\' action="">';
|
echo '<form name=\'form\' method=\'get\' action="">';
|
||||||
@ -38,17 +35,13 @@ if (isset($_SESSION['pseudo']) && isset($_SESSION['token']))
|
|||||||
echo 'Date début: <input type="text" id="datepicker" name="datepicker" value="' . $datepicker . '">';
|
echo 'Date début: <input type="text" id="datepicker" name="datepicker" value="' . $datepicker . '">';
|
||||||
echo '<input type="submit" value="Valider">';
|
echo '<input type="submit" value="Valider">';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
if(isset ($_GET['datepicker']))
|
if (isset($_GET['datepicker'])) {
|
||||||
{
|
if (($_GET['datepicker']) != null) {
|
||||||
if (($_GET['datepicker'])!=null)
|
|
||||||
{
|
|
||||||
echo '<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>';
|
echo '<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>';
|
||||||
echo '<br><a href="./menu.php">retour</a>';
|
echo '<br><a href="./menu.php">retour</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
include('connexion_erreur.php');
|
include('connexion_erreur.php');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -60,9 +53,15 @@ $(function () {
|
|||||||
spacingRight: 20
|
spacingRight: 20
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
text: '<?php if($_GET['graphique']=='Volume dans la cuve'){$text='Pompe';}else{ $text='Température';}echo $text;?> Château d\'eau'
|
text: '<?php if ($_GET['graphique'] == 'Volume dans la cuve') {
|
||||||
|
$text = 'Pompe';
|
||||||
|
} else {
|
||||||
|
$text = 'Température';
|
||||||
|
}
|
||||||
|
echo $text; ?> Château d\'eau'
|
||||||
},
|
},
|
||||||
subtitle: {<?php
|
subtitle: {
|
||||||
|
<?php
|
||||||
echo " text: 'Rosière-en-Haye données du " . $_GET['datepicker'] . "'";
|
echo " text: 'Rosière-en-Haye données du " . $_GET['datepicker'] . "'";
|
||||||
?>
|
?>
|
||||||
},
|
},
|
||||||
@ -77,7 +76,9 @@ $(function () {
|
|||||||
min: 0,
|
min: 0,
|
||||||
title: {
|
title: {
|
||||||
text: '<?php if ($_GET['graphique'] == 'Volume dans la cuve') echo 'Volume (m³)';
|
text: '<?php if ($_GET['graphique'] == 'Volume dans la cuve') echo 'Volume (m³)';
|
||||||
else{ echo'température (°C)';}?>'
|
else {
|
||||||
|
echo 'température (°C)';
|
||||||
|
} ?>'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
@ -89,7 +90,12 @@ $(function () {
|
|||||||
plotOptions: {
|
plotOptions: {
|
||||||
area: {
|
area: {
|
||||||
fillColor: {
|
fillColor: {
|
||||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1},
|
linearGradient: {
|
||||||
|
x1: 0,
|
||||||
|
y1: 0,
|
||||||
|
x2: 0,
|
||||||
|
y2: 1
|
||||||
|
},
|
||||||
stops: [
|
stops: [
|
||||||
[0, Highcharts.getOptions().colors[0]],
|
[0, Highcharts.getOptions().colors[0]],
|
||||||
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
|
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
|
||||||
@ -112,54 +118,45 @@ $(function () {
|
|||||||
series: [{
|
series: [{
|
||||||
type: 'area',
|
type: 'area',
|
||||||
name: '<?php if ($_GET['graphique'] == 'Volume dans la cuve') echo 'volume';
|
name: '<?php if ($_GET['graphique'] == 'Volume dans la cuve') echo 'volume';
|
||||||
else{ echo'température';}?>',
|
else {
|
||||||
|
echo 'température';
|
||||||
|
} ?>',
|
||||||
pointInterval: 900 * 1000,
|
pointInterval: 900 * 1000,
|
||||||
pointStart: Date.UTC(<?php $date = (string)$datepicker; $date= str_replace ( '-', ',', $date);echo $date;?>, 0, 0, 0, 0),
|
pointStart: Date.UTC(<?php $date = (string)$datepicker;
|
||||||
|
$date = str_replace('-', ',', $date);
|
||||||
|
echo $date; ?>, 0, 0, 0, 0),
|
||||||
data: [<?php
|
data: [<?php
|
||||||
if(isset($datepicker))
|
if (isset($datepicker)) {
|
||||||
{
|
if ($_GET['graphique'] == 'Température colonne') {
|
||||||
if ($_GET['graphique']=='Température colonne')
|
|
||||||
{
|
|
||||||
$result_co = $bdd->query("SELECT * FROM chateau WHERE date='$datepicker' ORDER BY date, heure ASC");
|
$result_co = $bdd->query("SELECT * FROM chateau WHERE date='$datepicker' ORDER BY date, heure ASC");
|
||||||
while($recup = $result_co->fetch(PDO::FETCH_ASSOC))
|
while ($recup = $result_co->fetch(PDO::FETCH_ASSOC)) {
|
||||||
{
|
|
||||||
$tableautemp_colonne[] = $recup['temp_colonne'];
|
$tableautemp_colonne[] = $recup['temp_colonne'];
|
||||||
}
|
}
|
||||||
for ($j=0;$j<count($tableautemp_colonne)-1;$j++)
|
for ($j = 0; $j < count($tableautemp_colonne) - 1; $j++) {
|
||||||
{
|
|
||||||
if ($j != 0) echo ", ";
|
if ($j != 0) echo ", ";
|
||||||
echo $tableautemp_colonne[$j];
|
echo $tableautemp_colonne[$j];
|
||||||
}
|
}
|
||||||
}
|
} else if ($_GET['graphique'] == 'Température ambiante') {
|
||||||
else if ($_GET['graphique']=='Température ambiante')
|
|
||||||
{
|
|
||||||
$result_co = $bdd->query("SELECT * FROM chateau WHERE date='$datepicker' ORDER BY date, heure ASC");
|
$result_co = $bdd->query("SELECT * FROM chateau WHERE date='$datepicker' ORDER BY date, heure ASC");
|
||||||
while($recup = $result_co->fetch(PDO::FETCH_ASSOC))
|
while ($recup = $result_co->fetch(PDO::FETCH_ASSOC)) {
|
||||||
{
|
|
||||||
$tableautemp_ambiante[] = $recup['temp_ambiante'];
|
$tableautemp_ambiante[] = $recup['temp_ambiante'];
|
||||||
}
|
}
|
||||||
for ($j=0;$j<count($tableautemp_ambiante)-1;$j++)
|
for ($j = 0; $j < count($tableautemp_ambiante) - 1; $j++) {
|
||||||
{
|
|
||||||
if ($j != 0) echo ", ";
|
if ($j != 0) echo ", ";
|
||||||
echo $tableautemp_ambiante[$j];
|
echo $tableautemp_ambiante[$j];
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$result_co = $bdd->query("SELECT * FROM chateau WHERE date='$datepicker' ORDER BY date, heure ASC");
|
$result_co = $bdd->query("SELECT * FROM chateau WHERE date='$datepicker' ORDER BY date, heure ASC");
|
||||||
while($recup = $result_co->fetch(PDO::FETCH_ASSOC))
|
while ($recup = $result_co->fetch(PDO::FETCH_ASSOC)) {
|
||||||
{
|
|
||||||
$tableau_hauteurvol[] = $recup['volume'];
|
$tableau_hauteurvol[] = $recup['volume'];
|
||||||
}
|
}
|
||||||
for ($j=0;$j<count($tableau_hauteurvol)-1;$j++)
|
for ($j = 0; $j < count($tableau_hauteurvol) - 1; $j++) {
|
||||||
{
|
|
||||||
if ($j != 0) echo ", ";
|
if ($j != 0) echo ", ";
|
||||||
echo $tableau_hauteurvol[$j];
|
echo $tableau_hauteurvol[$j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>]
|
||||||
]
|
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
10
head.php
10
head.php
@ -5,6 +5,7 @@ $debut_ex = (float)$usec + (float)$sec;
|
|||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" type="text/css" href="style.css">
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
@ -25,17 +26,18 @@ require('mysql.php');
|
|||||||
|
|
||||||
<!-- MENU -->
|
<!-- MENU -->
|
||||||
<div style="height:200px; text-align:right;">
|
<div style="height:200px; text-align:right;">
|
||||||
<?php if(@$infos_user){ echo strtoupper($infos_user['prenom'].' '.$infos_user['nom']); ?><br/>
|
<?php if (@$infos_user) {
|
||||||
|
echo strtoupper($infos_user['prenom'] . ' ' . $infos_user['nom']); ?><br />
|
||||||
(<?php echo strtolower($infos_user['pseudo']); ?>)<br />
|
(<?php echo strtolower($infos_user['pseudo']); ?>)<br />
|
||||||
<a href="connexion.php?action=logout">Se déconnecter</a><br /><br />
|
<a href="connexion.php?action=logout">Se déconnecter</a><br /><br />
|
||||||
<a href="index.php">Menu</a><br />
|
<a href="index.php">Menu</a><br />
|
||||||
<a href="alertes.php"><?php echo $result_nb_alertes; ?> Alertes</a><br />
|
<a href="alertes.php"><?php echo $result_nb_alertes; ?> Alertes</a><br />
|
||||||
<a href="membres.php">Membres</a>
|
<a href="membres.php">Membres</a>
|
||||||
<?php
|
<?php
|
||||||
}
|
} else echo 'Bonjour à vous!<br/><br/><a href="connexion.php">Se connecter</a>'; ?>
|
||||||
else echo 'Bonjour à vous!<br/><br/><a href="connexion.php">Se connecter</a>'; ?>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- FIN MENU -->
|
<!-- FIN MENU -->
|
||||||
|
|
||||||
<!-- CORPS -->
|
<!-- CORPS -->
|
||||||
<div><hr style="width:800px;">
|
<div>
|
||||||
|
<hr style="width:800px;">
|
@ -1,6 +1,5 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['droit'] > 0)
|
if (@$infos_user['droit'] > 0) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<h2>Château d'eau</h2>
|
<h2>Château d'eau</h2>
|
||||||
→ <a href="temperatures.php">Températures ambiante et de la colonne</a><br>
|
→ <a href="temperatures.php">Températures ambiante et de la colonne</a><br>
|
||||||
@ -15,6 +14,5 @@ if(@$infos_user['droit'] > 0)
|
|||||||
→ <a href="pompes_bar.php">Temps de fonctionnement des pompes</a><br>
|
→ <a href="pompes_bar.php">Temps de fonctionnement des pompes</a><br>
|
||||||
→ <a href="pompes_bar_volume.php">Temps de fonctionnement des pompes et volumes pompés</a><br>
|
→ <a href="pompes_bar_volume.php">Temps de fonctionnement des pompes et volumes pompés</a><br>
|
||||||
<?php
|
<?php
|
||||||
}
|
} else echo 'Vous n\'êtes pas autorisé/connecté!';
|
||||||
else echo 'Vous n\'êtes pas autorisé/connecté!';
|
|
||||||
include('foot.php'); ?>
|
include('foot.php'); ?>
|
158
membres.php
158
membres.php
@ -1,13 +1,11 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['droit'] > 3)
|
if (@$infos_user['droit'] > 3) {
|
||||||
{
|
|
||||||
|
|
||||||
function mdp_gen($taille)
|
function mdp_gen($taille)
|
||||||
{
|
{
|
||||||
$car = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789*-$';
|
$car = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789*-$';
|
||||||
$mdp = NULL;
|
$mdp = NULL;
|
||||||
for($i=0;$i<$taille;$i++)
|
for ($i = 0; $i < $taille; $i++) {
|
||||||
{
|
|
||||||
$mdp .= $car[rand(0, strlen($car) - 1)];
|
$mdp .= $car[rand(0, strlen($car) - 1)];
|
||||||
}
|
}
|
||||||
return $mdp;
|
return $mdp;
|
||||||
@ -17,25 +15,18 @@ $s_droits = "* ToutLesDroits(4) - ToutLesDroitsSaufGestionUtilisateurs(3)";
|
|||||||
|
|
||||||
$color = true;
|
$color = true;
|
||||||
|
|
||||||
if(isset($_GET['action']) && $_GET['action'] == "ajouter")
|
if (isset($_GET['action']) && $_GET['action'] == "ajouter") {
|
||||||
{
|
if (isset($_POST['pseudo']) && $_POST['pseudo'] != '' && !$connexion->query("SELECT * FROM comptes WHERE pseudo='" . $_POST['pseudo'] . "'")->fetch() && isset($_POST['nom']) && $_POST['nom'] != '' && isset($_POST['prenom']) && $_POST['prenom'] != '' && isset($_POST['num_rue']) && $_POST['num_rue'] != '' && isset($_POST['rue']) && $_POST['rue'] != '' && isset($_POST['ville']) && $_POST['ville'] != '' && isset($_POST['tel']) && $_POST['tel'] != '' && isset($_POST['fonction']) && $_POST['fonction'] != '' && isset($_POST['mdp']) && $_POST['mdp'] != '') {
|
||||||
if(isset($_POST['pseudo']) && $_POST['pseudo'] != '' && !$connexion->query("SELECT * FROM comptes WHERE pseudo='".$_POST['pseudo']."'")->fetch() && isset($_POST['nom']) && $_POST['nom'] != '' && isset($_POST['prenom']) && $_POST['prenom'] != '' && isset($_POST['num_rue']) && $_POST['num_rue'] != '' && isset($_POST['rue']) && $_POST['rue'] != '' && isset($_POST['ville']) && $_POST['ville'] != '' && isset($_POST['tel']) && $_POST['tel'] != '' && isset($_POST['fonction']) && $_POST['fonction'] != '' && isset($_POST['mdp']) && $_POST['mdp'] != '')
|
|
||||||
{
|
|
||||||
echo '<div style="text-align:center">';
|
echo '<div style="text-align:center">';
|
||||||
if($connexion->query("INSERT INTO `comptes` (`id_compte`, `nom`, `prenom`, `num_rue`, `rue`, `ville`, `tel`, `fonction`, `pseudo`, `mdp1`, `droit`, `suspendu`, `token`) VALUES (NULL, '".$_POST['nom']."', '".$_POST['prenom']."', '".$_POST['num_rue']."', '".$_POST['rue']."', '".$_POST['ville']."', '".$_POST['tel']."', '".$_POST['fonction']."', '".$_POST['pseudo']."', '".md5($_POST['mdp'])."', '".$_POST['droit']."', '".$_POST['suspendu']."', '0123');"))
|
if ($connexion->query("INSERT INTO `comptes` (`id_compte`, `nom`, `prenom`, `num_rue`, `rue`, `ville`, `tel`, `fonction`, `pseudo`, `mdp1`, `droit`, `suspendu`, `token`) VALUES (NULL, '" . $_POST['nom'] . "', '" . $_POST['prenom'] . "', '" . $_POST['num_rue'] . "', '" . $_POST['rue'] . "', '" . $_POST['ville'] . "', '" . $_POST['tel'] . "', '" . $_POST['fonction'] . "', '" . $_POST['pseudo'] . "', '" . md5($_POST['mdp']) . "', '" . $_POST['droit'] . "', '" . $_POST['suspendu'] . "', '0123');")) {
|
||||||
{
|
|
||||||
echo 'Utilisateur ajoute!</br></br>';
|
echo 'Utilisateur ajoute!</br></br>';
|
||||||
echo '<sub>Utilisateur: ' . $_POST['pseudo'] . '</br>';
|
echo '<sub>Utilisateur: ' . $_POST['pseudo'] . '</br>';
|
||||||
echo 'Mot de passe: ' . $_POST['mdp'] . '</sub>';
|
echo 'Mot de passe: ' . $_POST['mdp'] . '</sub>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo 'Une erreur est survenue.. (Aucun utilisateur n\'a ete ajoute)';
|
echo 'Une erreur est survenue.. (Aucun utilisateur n\'a ete ajoute)';
|
||||||
}
|
}
|
||||||
echo '<br/><br/><sub><a href="?action=retour">Retour</a></sub></div>';
|
echo '<br/><br/><sub><a href="?action=retour">Retour</a></sub></div>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '<h1>Ajout d\'utilisateur</h1>';
|
echo '<h1>Ajout d\'utilisateur</h1>';
|
||||||
echo '<form method="post">';
|
echo '<form method="post">';
|
||||||
echo '<table width="800" border="0" cellspacing="3" cellpadding="0" align="center">';
|
echo '<table width="800" border="0" cellspacing="3" cellpadding="0" align="center">';
|
||||||
@ -46,42 +37,55 @@ if(isset($_GET['action']) && $_GET['action'] == "ajouter")
|
|||||||
echo '</td> </tr>';
|
echo '</td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Nom:</td> <td><input type="text" name="nom" id="nom" value="' . @$_POST['nom'] . '">';
|
echo '<tr> <td class="tab_ajout">Nom:</td> <td><input type="text" name="nom" id="nom" value="' . @$_POST['nom'] . '">';
|
||||||
if (isset($_POST['nom']) && $_POST['nom'] == '')
|
if (isset($_POST['nom']) && $_POST['nom'] == '')
|
||||||
echo '<span class="erreur_ajo">Nom manquant</span>'; echo '</td> </tr>';
|
echo '<span class="erreur_ajo">Nom manquant</span>';
|
||||||
|
echo '</td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Prenom:</td> <td><input type="text" name="prenom" id="prenom" value="' . @$_POST['prenom'] . '">';
|
echo '<tr> <td class="tab_ajout">Prenom:</td> <td><input type="text" name="prenom" id="prenom" value="' . @$_POST['prenom'] . '">';
|
||||||
if (isset($_POST['prenom']) && $_POST['prenom'] == '')
|
if (isset($_POST['prenom']) && $_POST['prenom'] == '')
|
||||||
echo '<span class="erreur_ajo">Prenom manquant</span>'; echo '</td> </tr>';
|
echo '<span class="erreur_ajo">Prenom manquant</span>';
|
||||||
|
echo '</td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Adresse:</td> <td><input name="num_rue" type="text" id="num_rue" size="10" maxlength="6" value="' . @$_POST['num_rue'] . '">
|
echo '<tr> <td class="tab_ajout">Adresse:</td> <td><input name="num_rue" type="text" id="num_rue" size="10" maxlength="6" value="' . @$_POST['num_rue'] . '">
|
||||||
<input name="rue" type="text" id="rue" size="45" value="' . @$_POST['rue'] . '"></td> </tr>';
|
<input name="rue" type="text" id="rue" size="45" value="' . @$_POST['rue'] . '"></td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Ville:</td> <td><input name="ville" type="text" id="ville" size="45" value="' . @$_POST['ville'] . '">';
|
echo '<tr> <td class="tab_ajout">Ville:</td> <td><input name="ville" type="text" id="ville" size="45" value="' . @$_POST['ville'] . '">';
|
||||||
if (isset($_POST['num_rue']) && $_POST['num_rue'] == '' or isset($_POST['rue']) && $_POST['rue'] == '' or isset($_POST['ville']) && $_POST['ville'] == '')
|
if (isset($_POST['num_rue']) && $_POST['num_rue'] == '' or isset($_POST['rue']) && $_POST['rue'] == '' or isset($_POST['ville']) && $_POST['ville'] == '')
|
||||||
echo '<span class="erreur_ajo">Adresse incomplete</span>'; echo '</td> </tr>';
|
echo '<span class="erreur_ajo">Adresse incomplete</span>';
|
||||||
|
echo '</td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Tel.:</td> <td><input type="text" name="tel" id="tel" value="' . @$_POST['ville'] . '">';
|
echo '<tr> <td class="tab_ajout">Tel.:</td> <td><input type="text" name="tel" id="tel" value="' . @$_POST['ville'] . '">';
|
||||||
if (isset($_POST['tel']) && $_POST['tel'] == '')
|
if (isset($_POST['tel']) && $_POST['tel'] == '')
|
||||||
echo '<span class="erreur_ajo">Num. tel. manquant</span>'; echo '</td> </tr>';
|
echo '<span class="erreur_ajo">Num. tel. manquant</span>';
|
||||||
|
echo '</td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Fonction:</td> <td><input type="text" name="fonction" id="fonction" value="' . @$_POST['fonction'] . '">';
|
echo '<tr> <td class="tab_ajout">Fonction:</td> <td><input type="text" name="fonction" id="fonction" value="' . @$_POST['fonction'] . '">';
|
||||||
if (isset($_POST['fonction']) && $_POST['fonction'] == '')
|
if (isset($_POST['fonction']) && $_POST['fonction'] == '')
|
||||||
echo '<span class="erreur_ajo">Fonction manquante</span>'; echo '</td> </tr>';
|
echo '<span class="erreur_ajo">Fonction manquante</span>';
|
||||||
|
echo '</td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Droits*:</td> <td><select name="droit" id="droit">
|
echo '<tr> <td class="tab_ajout">Droits*:</td> <td><select name="droit" id="droit">
|
||||||
<option value="1" '; if(@$_POST['droit'] == "1") echo 'selected="selected"'; echo '>1</option>
|
<option value="1" ';
|
||||||
<option value="2" '; if(@$_POST['droit'] == "2") echo 'selected="selected"'; echo '>2</option>
|
if (@$_POST['droit'] == "1") echo 'selected="selected"';
|
||||||
<option value="3" '; if(@$_POST['droit'] == "3") echo 'selected="selected"'; echo '>3</option>
|
echo '>1</option>
|
||||||
<option value="4" '; if(@$_POST['droit'] == "4") echo 'selected="selected"'; echo '>4</option>
|
<option value="2" ';
|
||||||
|
if (@$_POST['droit'] == "2") echo 'selected="selected"';
|
||||||
|
echo '>2</option>
|
||||||
|
<option value="3" ';
|
||||||
|
if (@$_POST['droit'] == "3") echo 'selected="selected"';
|
||||||
|
echo '>3</option>
|
||||||
|
<option value="4" ';
|
||||||
|
if (@$_POST['droit'] == "4") echo 'selected="selected"';
|
||||||
|
echo '>4</option>
|
||||||
</select></td> </tr>';
|
</select></td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Suspendu:</td> <td><select name="suspendu" id="suspendu">
|
echo '<tr> <td class="tab_ajout">Suspendu:</td> <td><select name="suspendu" id="suspendu">
|
||||||
<option value="0">Non</option>
|
<option value="0">Non</option>
|
||||||
<option value="1" '; if(@$_POST['suspendu']) echo 'selected="selected"'; echo '>Oui</option>
|
<option value="1" ';
|
||||||
|
if (@$_POST['suspendu']) echo 'selected="selected"';
|
||||||
|
echo '>Oui</option>
|
||||||
</select></td> </tr>';
|
</select></td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Mot de passe:</td> <td><input type="text" name="mdp" id="mdp" value="' . @$_POST['mdp'] . '"> <a href="#" onClick="mdp.value=\'' . mdp_gen(6) . '\'; this.innerHTML=\'\'">Generer un mot de passe aleatoire</a>';
|
echo '<tr> <td class="tab_ajout">Mot de passe:</td> <td><input type="text" name="mdp" id="mdp" value="' . @$_POST['mdp'] . '"> <a href="#" onClick="mdp.value=\'' . mdp_gen(6) . '\'; this.innerHTML=\'\'">Generer un mot de passe aleatoire</a>';
|
||||||
if (isset($_POST['mdp']) && $_POST['mdp'] == '')
|
if (isset($_POST['mdp']) && $_POST['mdp'] == '')
|
||||||
echo '</br><span class="erreur_ajo">Mot de passe manquant</span>'; echo '</td> </tr>';
|
echo '</br><span class="erreur_ajo">Mot de passe manquant</span>';
|
||||||
|
echo '</td> </tr>';
|
||||||
echo '</table><div style="text-align:center"><br/><input type="submit" value="Ajouter l\'utilisateur"></form>';
|
echo '</table><div style="text-align:center"><br/><input type="submit" value="Ajouter l\'utilisateur"></form>';
|
||||||
echo '<br/><br/><sub>' . $s_droits . '</sub></div>';
|
echo '<br/><br/><sub>' . $s_droits . '</sub></div>';
|
||||||
}
|
}
|
||||||
}
|
} elseif (isset($_GET['action']) && isset($_GET['id']) && $_GET['action'] == "modifier") {
|
||||||
elseif(isset($_GET['action']) && isset($_GET['id']) && $_GET['action'] == "modifier")
|
if (isset($_POST['nom']) && isset($_POST['prenom']) && isset($_POST['num_rue']) && isset($_POST['rue']) && isset($_POST['ville']) && isset($_POST['tel']) && isset($_POST['fonction'])) {
|
||||||
{
|
|
||||||
if(isset($_POST['nom']) && isset($_POST['prenom']) && isset($_POST['num_rue']) && isset($_POST['rue']) && isset($_POST['ville']) && isset($_POST['tel']) && isset($_POST['fonction']))
|
|
||||||
{
|
|
||||||
$requ = "UPDATE `comptes` SET `token` ='0123'";
|
$requ = "UPDATE `comptes` SET `token` ='0123'";
|
||||||
if (isset($_POST['nom']) && $_POST['nom'] != '') $requ .= ", `nom` = '" . $_POST['nom'] . "'";
|
if (isset($_POST['nom']) && $_POST['nom'] != '') $requ .= ", `nom` = '" . $_POST['nom'] . "'";
|
||||||
else echo '<span class="erreur_mod">- NOM non modifie -</span></br>';
|
else echo '<span class="erreur_mod">- NOM non modifie -</span></br>';
|
||||||
@ -102,22 +106,15 @@ elseif(isset($_GET['action']) && isset($_GET['id']) && $_GET['action'] == "modi
|
|||||||
if (isset($_POST['mdp']) && $_POST['mdp'] != '') $requ .= ", `mdp1` = '" . md5($_POST['mdp']) . "'";
|
if (isset($_POST['mdp']) && $_POST['mdp'] != '') $requ .= ", `mdp1` = '" . md5($_POST['mdp']) . "'";
|
||||||
$requ .= " WHERE `id_compte` =" . $_GET['id'] . ";";
|
$requ .= " WHERE `id_compte` =" . $_GET['id'] . ";";
|
||||||
echo '<div style="text-align:center">';
|
echo '<div style="text-align:center">';
|
||||||
if($connexion->query($requ))
|
if ($connexion->query($requ)) {
|
||||||
{
|
|
||||||
echo 'Les modifications pour l\'utilisateur ' . $_POST['pseudo'] . ' ont ete prises en compte!';
|
echo 'Les modifications pour l\'utilisateur ' . $_POST['pseudo'] . ' ont ete prises en compte!';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo 'Une erreur est survenue.. (Modifications non effectuees)';
|
echo 'Une erreur est survenue.. (Modifications non effectuees)';
|
||||||
}
|
}
|
||||||
echo '<br/><sub><a href="?action=retour">Retour</a></sub></div>';
|
echo '<br/><sub><a href="?action=retour">Retour</a></sub></div>';
|
||||||
}
|
} else {
|
||||||
else
|
if ($result = $connexion->query("SELECT * FROM comptes WHERE id_compte='" . $_GET['id'] . "'")) {
|
||||||
{
|
if ($utilisateur = $result->fetch()) {
|
||||||
if($result = $connexion->query("SELECT * FROM comptes WHERE id_compte='".$_GET['id']."'"))
|
|
||||||
{
|
|
||||||
if($utilisateur = $result->fetch())
|
|
||||||
{
|
|
||||||
echo '<h1>Modification d\'utilisateur</h1>';
|
echo '<h1>Modification d\'utilisateur</h1>';
|
||||||
echo '<form method="post">';
|
echo '<form method="post">';
|
||||||
echo '<table width="800" border="0" cellspacing="3" cellpadding="0" align="center">';
|
echo '<table width="800" border="0" cellspacing="3" cellpadding="0" align="center">';
|
||||||
@ -130,69 +127,62 @@ elseif(isset($_GET['action']) && isset($_GET['id']) && $_GET['action'] == "modi
|
|||||||
echo '<tr> <td class="tab_ajout">Tel.:</td> <td><input type="text" name="tel" id="tel" value="' . $utilisateur['tel'] . '"></td> </tr>';
|
echo '<tr> <td class="tab_ajout">Tel.:</td> <td><input type="text" name="tel" id="tel" value="' . $utilisateur['tel'] . '"></td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Fonction:</td> <td><input type="text" name="fonction" id="fonction" value="' . $utilisateur['fonction'] . '"></td> </tr>';
|
echo '<tr> <td class="tab_ajout">Fonction:</td> <td><input type="text" name="fonction" id="fonction" value="' . $utilisateur['fonction'] . '"></td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Droits*:</td> <td><select name="droit" id="droit">
|
echo '<tr> <td class="tab_ajout">Droits*:</td> <td><select name="droit" id="droit">
|
||||||
<option value="1" '; if($utilisateur['droit'] == "1") echo 'selected="selected"'; echo '>1</option>
|
<option value="1" ';
|
||||||
<option value="2" '; if($utilisateur['droit'] == "2") echo 'selected="selected"'; echo '>2</option>
|
if ($utilisateur['droit'] == "1") echo 'selected="selected"';
|
||||||
<option value="3" '; if($utilisateur['droit'] == "3") echo 'selected="selected"'; echo '>3</option>
|
echo '>1</option>
|
||||||
<option value="4" '; if($utilisateur['droit'] == "4") echo 'selected="selected"'; echo '>4</option>
|
<option value="2" ';
|
||||||
|
if ($utilisateur['droit'] == "2") echo 'selected="selected"';
|
||||||
|
echo '>2</option>
|
||||||
|
<option value="3" ';
|
||||||
|
if ($utilisateur['droit'] == "3") echo 'selected="selected"';
|
||||||
|
echo '>3</option>
|
||||||
|
<option value="4" ';
|
||||||
|
if ($utilisateur['droit'] == "4") echo 'selected="selected"';
|
||||||
|
echo '>4</option>
|
||||||
</select></td> </tr>';
|
</select></td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Suspendu:</td> <td><select name="suspendu" id="suspendu">
|
echo '<tr> <td class="tab_ajout">Suspendu:</td> <td><select name="suspendu" id="suspendu">
|
||||||
<option value="0">Non</option>
|
<option value="0">Non</option>
|
||||||
<option value="1" '; if($utilisateur['suspendu'] == "1") echo 'selected="selected"'; echo '>Oui</option>
|
<option value="1" ';
|
||||||
|
if ($utilisateur['suspendu'] == "1") echo 'selected="selected"';
|
||||||
|
echo '>Oui</option>
|
||||||
</select></td> </tr>';
|
</select></td> </tr>';
|
||||||
echo '<tr> <td class="tab_ajout">Nouveau mot de passe:</td> <td><input type="text" name="mdp" id="mdp"> (non-obligatoire)</td> </tr>';
|
echo '<tr> <td class="tab_ajout">Nouveau mot de passe:</td> <td><input type="text" name="mdp" id="mdp"> (non-obligatoire)</td> </tr>';
|
||||||
echo '</table><div style="text-align:center"><br/><input type="submit" value="Enregistrer les modifications"></form>';
|
echo '</table><div style="text-align:center"><br/><input type="submit" value="Enregistrer les modifications"></form>';
|
||||||
echo '<br/><br/><sub>' . $s_droits . '</sub></div>';
|
echo '<br/><br/><sub>' . $s_droits . '</sub></div>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo 'Une erreur est survenue.. (Aucun utilisateur avec l\'id: ' . $_GET['id'] . ')';
|
echo 'Une erreur est survenue.. (Aucun utilisateur avec l\'id: ' . $_GET['id'] . ')';
|
||||||
echo '<hr width="800px"><sub><a href="?action=retour">Retour</a></sub>';
|
echo '<hr width="800px"><sub><a href="?action=retour">Retour</a></sub>';
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo 'Une erreur est survenue.. (La requete n\'a pas aboutie)';
|
echo 'Une erreur est survenue.. (La requete n\'a pas aboutie)';
|
||||||
echo '<hr width="800px"><sub><a href="?action=retour">Retour</a></sub>';
|
echo '<hr width="800px"><sub><a href="?action=retour">Retour</a></sub>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} elseif (isset($_GET['action']) && isset($_GET['id']) && $_GET['action'] == "supprimer") {
|
||||||
elseif(isset($_GET['action']) && isset($_GET['id']) && $_GET['action'] == "supprimer")
|
|
||||||
{
|
|
||||||
echo '<h1>Suppression d\'utilisateur</h1><div style="text-align:center">';
|
echo '<h1>Suppression d\'utilisateur</h1><div style="text-align:center">';
|
||||||
if(isset($_GET['token']))
|
if (isset($_GET['token'])) {
|
||||||
{
|
|
||||||
if ($connexion->query("DELETE FROM comptes WHERE id_compte='" . $_GET['id'] . "'"))
|
if ($connexion->query("DELETE FROM comptes WHERE id_compte='" . $_GET['id'] . "'"))
|
||||||
echo 'Utilisateur supprime!';
|
echo 'Utilisateur supprime!';
|
||||||
else
|
else
|
||||||
echo 'Erreur lors de la suppression..';
|
echo 'Erreur lors de la suppression..';
|
||||||
echo '<br/><sub><a href="?action=retour">Retour</a></sub>';
|
echo '<br/><sub><a href="?action=retour">Retour</a></sub>';
|
||||||
}
|
} else {
|
||||||
else
|
if ($result = $connexion->query("SELECT * FROM comptes WHERE id_compte='" . $_GET['id'] . "'")) {
|
||||||
{
|
if ($utilisateur = $result->fetch()) {
|
||||||
if($result = $connexion->query("SELECT * FROM comptes WHERE id_compte='".$_GET['id']."'"))
|
|
||||||
{
|
|
||||||
if($utilisateur = $result->fetch())
|
|
||||||
{
|
|
||||||
echo 'Voulez-vous supprimer l\'utilisateur (' . $utilisateur['pseudo'] . ') ' . $utilisateur['nom'] . ' ' . $utilisateur['prenom'] . '?</br>';
|
echo 'Voulez-vous supprimer l\'utilisateur (' . $utilisateur['pseudo'] . ') ' . $utilisateur['nom'] . ' ' . $utilisateur['prenom'] . '?</br>';
|
||||||
echo '<a href="?id=' . $_GET['id'] . '&action=supprimer&token=' . $utilisateur['token'] . '">Oui</a> - <a href="?id=' . $_GET['id'] . '">Non</a>';
|
echo '<a href="?id=' . $_GET['id'] . '&action=supprimer&token=' . $utilisateur['token'] . '">Oui</a> - <a href="?id=' . $_GET['id'] . '">Non</a>';
|
||||||
echo '<br/><sub>L\'action de supprimer un utilisateur est irreversible..</sub>';
|
echo '<br/><sub>L\'action de supprimer un utilisateur est irreversible..</sub>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo 'Une erreur est survenue.. (Aucun utilisateur avec l\'id: ' . $_GET['id'] . ')';
|
echo 'Une erreur est survenue.. (Aucun utilisateur avec l\'id: ' . $_GET['id'] . ')';
|
||||||
echo '<br/><sub><a href="?action=retour">Retour</a></sub>';
|
echo '<br/><sub><a href="?action=retour">Retour</a></sub>';
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo 'Une erreur est survenue.. (La requete n\'a pas aboutie)';
|
echo 'Une erreur est survenue.. (La requete n\'a pas aboutie)';
|
||||||
echo '<br/><sub><a href="?action=retour">Retour</a></sub>';
|
echo '<br/><sub><a href="?action=retour">Retour</a></sub>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '<h1>Gestion des utilisateurs</h1>';
|
echo '<h1>Gestion des utilisateurs</h1>';
|
||||||
echo '<table width="800px" border="0" cellspacing="0" cellpadding="0" align="center" style="text-align: center;">';
|
echo '<table width="800px" border="0" cellspacing="0" cellpadding="0" align="center" style="text-align: center;">';
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
@ -206,10 +196,10 @@ else
|
|||||||
echo '<td>Actions</td>';
|
echo '<td>Actions</td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
$result = $connexion->query("SELECT * FROM comptes");
|
$result = $connexion->query("SELECT * FROM comptes");
|
||||||
while($compte = $result->fetch())
|
while ($compte = $result->fetch()) {
|
||||||
{
|
|
||||||
$color = !$color;
|
$color = !$color;
|
||||||
if($color) $couleur = "#9CF"; else $couleur = "#9CC";
|
if ($color) $couleur = "#9CF";
|
||||||
|
else $couleur = "#9CC";
|
||||||
|
|
||||||
echo '<tr style="background-color:' . $couleur . ';">';
|
echo '<tr style="background-color:' . $couleur . ';">';
|
||||||
echo '<td class="ligne">' . $compte['pseudo'] . '</td>';
|
echo '<td class="ligne">' . $compte['pseudo'] . '</td>';
|
||||||
@ -218,7 +208,10 @@ else
|
|||||||
echo '<td class="ligne">' . $compte['num_rue'] . ', ' . $compte['rue'] . '</br>' . $compte['ville'] . '</td>';
|
echo '<td class="ligne">' . $compte['num_rue'] . ', ' . $compte['rue'] . '</br>' . $compte['ville'] . '</td>';
|
||||||
echo '<td class="ligne">' . $compte['tel'] . '</td>';
|
echo '<td class="ligne">' . $compte['tel'] . '</td>';
|
||||||
echo '<td class="ligne">' . $compte['droit'] . '<sup>*</sup></td>';
|
echo '<td class="ligne">' . $compte['droit'] . '<sup>*</sup></td>';
|
||||||
echo '<td class="ligne">'; if($compte['suspendu']) echo 'Oui'; else echo 'Non'; echo '</td>';
|
echo '<td class="ligne">';
|
||||||
|
if ($compte['suspendu']) echo 'Oui';
|
||||||
|
else echo 'Non';
|
||||||
|
echo '</td>';
|
||||||
echo '<td class="ligne"><a href="?id=' . $compte['id_compte'] . '&action=modifier">Modifier</a></br><a href="?id=' . $compte['id_compte'] . '&action=supprimer">Supprimer</a></td>';
|
echo '<td class="ligne"><a href="?id=' . $compte['id_compte'] . '&action=modifier">Modifier</a></br><a href="?id=' . $compte['id_compte'] . '&action=supprimer">Supprimer</a></td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
@ -227,6 +220,5 @@ else
|
|||||||
|
|
||||||
echo '<br/><br/><sub>' . $s_droits . '</sub>';
|
echo '<br/><br/><sub>' . $s_droits . '</sub>';
|
||||||
}
|
}
|
||||||
}
|
} else echo 'Vous n\'êtes pas autorisé/connecté!';
|
||||||
else echo 'Vous n\'êtes pas autorisé/connecté!';
|
include('foot.php');
|
||||||
include('foot.php'); ?>
|
|
||||||
|
@ -1 +1,8 @@
|
|||||||
<div id='tameteo' style='font-family:Arial;text-align:center;border:solid 1px #000000; background:#DCEDE0; width:145px; padding:4px'><a href='http://www.ta-meteo.fr/rosieres-en-haye' target='_blank' title='M<>t<EFBFBD>o Rosieres en haye' style='font-weight: bold;font-size:14px;text-decoration:none;color:#000000;line-height:12px;'>Rosieres en haye</a><br/><a href='http://www.ta-meteo.fr' target='_blank' title='ta-meteo'><img src='http://www.ta-meteo.fr/widget4/efb900373acd41209aa1c2458ac13c1a.png' border='0'></a><br/><a href='http://www.meteonet.org' style='font-size:10px;text-decoration:none;color:#000000;line-height:10px;' target='_blank' >© Données meteonet</a></div>
|
<div id='tameteo'
|
||||||
|
style='font-family:Arial;text-align:center;border:solid 1px #000000; background:#DCEDE0; width:145px; padding:4px'>
|
||||||
|
<a href='http://www.ta-meteo.fr/rosieres-en-haye' target='_blank' title='M<>t<EFBFBD>o Rosieres en haye'
|
||||||
|
style='font-weight: bold;font-size:14px;text-decoration:none;color:#000000;line-height:12px;'>Rosieres en
|
||||||
|
haye</a><br /><a href='http://www.ta-meteo.fr' target='_blank' title='ta-meteo'><img
|
||||||
|
src='http://www.ta-meteo.fr/widget4/efb900373acd41209aa1c2458ac13c1a.png' border='0'></a><br /><a
|
||||||
|
href='http://www.meteonet.org' style='font-size:10px;text-decoration:none;color:#000000;line-height:10px;'
|
||||||
|
target='_blank'>© Données meteonet</a></div>
|
@ -6,12 +6,10 @@ $base_bdd = 'chateau2';
|
|||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
$connexion = new PDO('mysql:host=' . $host_bdd . ';dbname=' . $base_bdd, $user_bdd, $pass_bdd);
|
$connexion = new PDO('mysql:host=' . $host_bdd . ';dbname=' . $base_bdd, $user_bdd, $pass_bdd);
|
||||||
if(@$_SESSION['user'])
|
if (@$_SESSION['user']) {
|
||||||
{
|
|
||||||
$result_infos_user = $connexion->query("SELECT * FROM comptes WHERE pseudo='" . $_SESSION['user'] . "'");
|
$result_infos_user = $connexion->query("SELECT * FROM comptes WHERE pseudo='" . $_SESSION['user'] . "'");
|
||||||
$infos_user = $result_infos_user->fetch();
|
$infos_user = $result_infos_user->fetch();
|
||||||
if($_SESSION['token'] != $infos_user['token'])
|
if ($_SESSION['token'] != $infos_user['token']) {
|
||||||
{
|
|
||||||
$_SESSION['user'] = '';
|
$_SESSION['user'] = '';
|
||||||
$_SESSION['token'] = '';
|
$_SESSION['token'] = '';
|
||||||
$infos_user = 0;
|
$infos_user = 0;
|
||||||
@ -19,4 +17,3 @@ if(@$_SESSION['user'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result_nb_alertes = $connexion->query("SELECT count(*) FROM alertes WHERE acquitte='0'")->fetchColumn();
|
$result_nb_alertes = $connexion->query("SELECT count(*) FROM alertes WHERE acquitte='0'")->fetchColumn();
|
||||||
?>
|
|
22
pompes.php
22
pompes.php
@ -1,6 +1,5 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['droit'] > 0)
|
if (@$infos_user['droit'] > 0) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<script src="js/highcharts.js"></script>
|
<script src="js/highcharts.js"></script>
|
||||||
<script src="js/modules/exporting.js"></script>
|
<script src="js/modules/exporting.js"></script>
|
||||||
@ -13,13 +12,10 @@ if(@$infos_user['droit'] > 0)
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET['au']))
|
if (isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET['au'])) {
|
||||||
{
|
|
||||||
$date1 = date('Y-m-d', strtotime($_GET['du']));
|
$date1 = date('Y-m-d', strtotime($_GET['du']));
|
||||||
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
$date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
||||||
$date2 = date('Y-m-d');
|
$date2 = date('Y-m-d');
|
||||||
}
|
}
|
||||||
@ -30,8 +26,7 @@ $while_date = $date1;
|
|||||||
|
|
||||||
$s_date = '';
|
$s_date = '';
|
||||||
|
|
||||||
while(strtotime($while_date) <= strtotime($date2))
|
while (strtotime($while_date) <= strtotime($date2)) {
|
||||||
{
|
|
||||||
$tab_pp1[$while_date] = 'null';
|
$tab_pp1[$while_date] = 'null';
|
||||||
$tab_pp2[$while_date] = 'null';
|
$tab_pp2[$while_date] = 'null';
|
||||||
|
|
||||||
@ -39,8 +34,7 @@ while(strtotime($while_date) <= strtotime($date2))
|
|||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
while($fetch = $result_temp->fetch())
|
while ($fetch = $result_temp->fetch()) {
|
||||||
{
|
|
||||||
$tab_pp1[$fetch['date']] = $fetch['temp_marche_pp1'];
|
$tab_pp1[$fetch['date']] = $fetch['temp_marche_pp1'];
|
||||||
$tab_pp2[$fetch['date']] = $fetch['temp_marche_pp2'];
|
$tab_pp2[$fetch['date']] = $fetch['temp_marche_pp2'];
|
||||||
}
|
}
|
||||||
@ -50,8 +44,7 @@ $s_temp_pp2= '';
|
|||||||
|
|
||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
|
|
||||||
for($i = 0; $i < count($tab_pp1); $i++)
|
for ($i = 0; $i < count($tab_pp1); $i++) {
|
||||||
{
|
|
||||||
$s_temp_pp1 = $s_temp_pp1 . $tab_pp1[$while_date] . ',';
|
$s_temp_pp1 = $s_temp_pp1 . $tab_pp1[$while_date] . ',';
|
||||||
$s_temp_pp2 = $s_temp_pp2 . $tab_pp2[$while_date] . ',';
|
$s_temp_pp2 = $s_temp_pp2 . $tab_pp2[$while_date] . ',';
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
@ -112,6 +105,5 @@ $(function () {
|
|||||||
|
|
||||||
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
|
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
} else echo 'Vous n\'êtes pas autorisé/connecté!';
|
||||||
else echo 'Vous n\'êtes pas autorisé/connecté!';
|
|
||||||
include('foot.php'); ?>
|
include('foot.php'); ?>
|
@ -1,6 +1,5 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['droit'] > 0)
|
if (@$infos_user['droit'] > 0) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<script src="js/highcharts.js"></script>
|
<script src="js/highcharts.js"></script>
|
||||||
<script src="js/modules/exporting.js"></script>
|
<script src="js/modules/exporting.js"></script>
|
||||||
@ -13,13 +12,10 @@ if(@$infos_user['droit'] > 0)
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET['au']))
|
if (isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET['au'])) {
|
||||||
{
|
|
||||||
$date1 = date('Y-m-d', strtotime($_GET['du']));
|
$date1 = date('Y-m-d', strtotime($_GET['du']));
|
||||||
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
$date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
||||||
$date2 = date('Y-m-d');
|
$date2 = date('Y-m-d');
|
||||||
}
|
}
|
||||||
@ -29,8 +25,7 @@ $result_pomp = $connexion->query("SELECT * FROM relevage WHERE heure='00:15:00'
|
|||||||
$s_date = '';
|
$s_date = '';
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
while($fetch = $result_pomp->fetch())
|
while ($fetch = $result_pomp->fetch()) {
|
||||||
{
|
|
||||||
$s_date = $s_date . '"' . date("d/m/y", strtotime($fetch['date'])) . '",';
|
$s_date = $s_date . '"' . date("d/m/y", strtotime($fetch['date'])) . '",';
|
||||||
$tab_pomp1[$i] = $fetch['temp_marche_pp1'];
|
$tab_pomp1[$i] = $fetch['temp_marche_pp1'];
|
||||||
$tab_pomp2[$i] = $fetch['temp_marche_pp2'];
|
$tab_pomp2[$i] = $fetch['temp_marche_pp2'];
|
||||||
@ -44,8 +39,7 @@ $vol_minp1 = 100;
|
|||||||
$vol_totp1 = 0;
|
$vol_totp1 = 0;
|
||||||
|
|
||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
for($i = 0; $i < @count($tab_pomp1)-1; $i++)
|
for ($i = 0; $i < @count($tab_pomp1) - 1; $i++) {
|
||||||
{
|
|
||||||
$volume = $tab_pomp1[$i + 1] - $tab_pomp1[$i];
|
$volume = $tab_pomp1[$i + 1] - $tab_pomp1[$i];
|
||||||
if ($volume < $vol_minp1) $vol_minp1 = $volume;
|
if ($volume < $vol_minp1) $vol_minp1 = $volume;
|
||||||
if ($volume > $vol_maxp1) $vol_maxp1 = $volume;
|
if ($volume > $vol_maxp1) $vol_maxp1 = $volume;
|
||||||
@ -57,8 +51,7 @@ $while_date = $date1;
|
|||||||
$vol_maxp2 = 0;
|
$vol_maxp2 = 0;
|
||||||
$vol_minp2 = 100;
|
$vol_minp2 = 100;
|
||||||
$vol_totp2 = 0;
|
$vol_totp2 = 0;
|
||||||
for($i = 0; $i < @count($tab_pomp2)-1; $i++)
|
for ($i = 0; $i < @count($tab_pomp2) - 1; $i++) {
|
||||||
{
|
|
||||||
$volume = $tab_pomp2[$i + 1] - $tab_pomp2[$i];
|
$volume = $tab_pomp2[$i + 1] - $tab_pomp2[$i];
|
||||||
if ($volume < $vol_minp2) $vol_minp2 = $volume;
|
if ($volume < $vol_minp2) $vol_minp2 = $volume;
|
||||||
if ($volume > $vol_maxp2) $vol_maxp2 = $volume;
|
if ($volume > $vol_maxp2) $vol_maxp2 = $volume;
|
||||||
@ -136,6 +129,5 @@ $(function () {
|
|||||||
|
|
||||||
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
|
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
} else echo 'Vous n\'êtes pas autorisé/connecté!';
|
||||||
else echo 'Vous n\'êtes pas autorisé/connecté!';
|
|
||||||
include('foot.php'); ?>
|
include('foot.php'); ?>
|
@ -1,6 +1,5 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['droit'] > 0)
|
if (@$infos_user['droit'] > 0) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<script src="js/highcharts.js"></script>
|
<script src="js/highcharts.js"></script>
|
||||||
<script src="js/modules/exporting.js"></script>
|
<script src="js/modules/exporting.js"></script>
|
||||||
@ -18,8 +17,7 @@ if(isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET[
|
|||||||
$date1 = date("Y-m-d", strtotime("-1 day", strtotime($_GET['du'])));
|
$date1 = date("Y-m-d", strtotime("-1 day", strtotime($_GET['du'])));
|
||||||
$date1bis = date('Y-m-d', strtotime($_GET['du']));
|
$date1bis = date('Y-m-d', strtotime($_GET['du']));
|
||||||
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
||||||
}
|
} else //Sinon on prend les valeurs du dernier mois
|
||||||
else //Sinon on prend les valeurs du dernier mois
|
|
||||||
{
|
{
|
||||||
$date1bis = $date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
$date1bis = $date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
||||||
$date2 = date('Y-m-d', strtotime("+1 day", strtotime(date('Y-m-d'))));
|
$date2 = date('Y-m-d', strtotime("+1 day", strtotime(date('Y-m-d'))));
|
||||||
@ -31,16 +29,14 @@ $result_vol_22 = $connexion->query("SELECT * FROM chateau WHERE heure='22:00:00'
|
|||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
$s_date = '';
|
$s_date = '';
|
||||||
|
|
||||||
while(strtotime($while_date) <= strtotime($date2))
|
while (strtotime($while_date) <= strtotime($date2)) {
|
||||||
{
|
|
||||||
$tab_vol_6[$while_date] = 'null';
|
$tab_vol_6[$while_date] = 'null';
|
||||||
$tab_vol_22[$while_date] = 'null';
|
$tab_vol_22[$while_date] = 'null';
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$while_datebis = $date1bis;
|
$while_datebis = $date1bis;
|
||||||
while(strtotime($while_datebis) <= strtotime($date2))
|
while (strtotime($while_datebis) <= strtotime($date2)) {
|
||||||
{
|
|
||||||
$s_date = $s_date . '"' . date("d/m/y", strtotime($while_datebis)) . '",';
|
$s_date = $s_date . '"' . date("d/m/y", strtotime($while_datebis)) . '",';
|
||||||
$while_datebis = date("Y-m-d", strtotime("+1 day", strtotime($while_datebis)));
|
$while_datebis = date("Y-m-d", strtotime("+1 day", strtotime($while_datebis)));
|
||||||
}
|
}
|
||||||
@ -64,8 +60,7 @@ $Nbjours_V1=0;
|
|||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
for ($i = 0; $i < count($tab_vol_6); $i++) //On remplie s_vol_6 des valeurs de la bdd pour highchart
|
for ($i = 0; $i < count($tab_vol_6); $i++) //On remplie s_vol_6 des valeurs de la bdd pour highchart
|
||||||
{
|
{
|
||||||
if(isset($tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]) && $tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))] != 'null' && $tab_vol_6[$while_date] != 'null')
|
if (isset($tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]) && $tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))] != 'null' && $tab_vol_6[$while_date] != 'null') {
|
||||||
{
|
|
||||||
$vol = ($tab_vol_6[$while_date] - $tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]);
|
$vol = ($tab_vol_6[$while_date] - $tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]);
|
||||||
$Nbjours_V1++;
|
$Nbjours_V1++;
|
||||||
|
|
||||||
@ -75,8 +70,7 @@ for($i = 0; $i < count($tab_vol_6); $i++)//On remplie s_vol_6 des valeurs de la
|
|||||||
$voltot = $voltot + $vol;
|
$voltot = $voltot + $vol;
|
||||||
|
|
||||||
$s_vol_6 = $s_vol_6 . $vol . ','; //On ajoute la valeur au tableau
|
$s_vol_6 = $s_vol_6 . $vol . ','; //On ajoute la valeur au tableau
|
||||||
}
|
} else if ($i != 0) $s_vol_6 = $s_vol_6 . 'null,'; //Si aucune valeur on met null dans le tableau
|
||||||
else if ($i != 0) $s_vol_6 = $s_vol_6.'null,'; //Si aucune valeur on met null dans le tableau
|
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,18 +102,14 @@ $Nbjours_P1 = 0;
|
|||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
for ($i = 0; $i < $Nbjours + 1; $i++) //On remplie s_pomp1 des valeurs de la bdd pour highchart
|
for ($i = 0; $i < $Nbjours + 1; $i++) //On remplie s_pomp1 des valeurs de la bdd pour highchart
|
||||||
{
|
{
|
||||||
if(isset($tab_pomp1[$while_date]) && $tab_pomp1[$while_date] != 'null' and $i != 0)
|
if (isset($tab_pomp1[$while_date]) && $tab_pomp1[$while_date] != 'null' and $i != 0) {
|
||||||
{
|
|
||||||
if (!isset($tab_pomp1[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))])) //On vérifie que la valeur précédente éxiste
|
if (!isset($tab_pomp1[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))])) //On vérifie que la valeur précédente éxiste
|
||||||
if(isset($tab_pomp1[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))]))
|
if (isset($tab_pomp1[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))])) {
|
||||||
{
|
|
||||||
$vol = $tab_pomp1[$while_date] - $tab_pomp1[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))];
|
$vol = $tab_pomp1[$while_date] - $tab_pomp1[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))];
|
||||||
$Nbjours_P1++;
|
$Nbjours_P1++;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$vol = '0';
|
$vol = '0';
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
$vol = $tab_pomp1[$while_date] - $tab_pomp1[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))];
|
$vol = $tab_pomp1[$while_date] - $tab_pomp1[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))];
|
||||||
$Nbjours_P1++;
|
$Nbjours_P1++;
|
||||||
}
|
}
|
||||||
@ -132,8 +122,7 @@ for($i = 0; $i < $Nbjours+1;$i++)//On remplie s_pomp1 des valeurs de la bdd pour
|
|||||||
|
|
||||||
$s_pomp1 = $s_pomp1 . $vol . ','; //On ajoute la valeur au tableau
|
$s_pomp1 = $s_pomp1 . $vol . ','; //On ajoute la valeur au tableau
|
||||||
|
|
||||||
}
|
} else if ($i != 0) $s_pomp1 = $s_pomp1 . 'null,'; //Si aucune valeur on met null dans le tableau
|
||||||
else if ($i != 0) $s_pomp1 = $s_pomp1.'null,'; //Si aucune valeur on met null dans le tableau
|
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,18 +135,14 @@ $Nbjours_P2=0;
|
|||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
for ($i = 0; $i < $Nbjours + 1; $i++) //On remplie s_pomp2 des valeurs de la bdd pour highchart
|
for ($i = 0; $i < $Nbjours + 1; $i++) //On remplie s_pomp2 des valeurs de la bdd pour highchart
|
||||||
{
|
{
|
||||||
if(isset($tab_pomp2[$while_date]) && $tab_pomp2[$while_date] != 'null' and $i != 0)
|
if (isset($tab_pomp2[$while_date]) && $tab_pomp2[$while_date] != 'null' and $i != 0) {
|
||||||
{
|
|
||||||
if (!isset($tab_pomp2[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))])) //On vérifie que la valeur précédente éxiste
|
if (!isset($tab_pomp2[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))])) //On vérifie que la valeur précédente éxiste
|
||||||
if(isset($tab_pomp2[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))]))
|
if (isset($tab_pomp2[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))])) {
|
||||||
{
|
|
||||||
$vol = $tab_pomp2[$while_date] - $tab_pomp2[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))];
|
$vol = $tab_pomp2[$while_date] - $tab_pomp2[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))];
|
||||||
$Nbjours_P2++;
|
$Nbjours_P2++;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$vol = '0';
|
$vol = '0';
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
$vol = $tab_pomp2[$while_date] - $tab_pomp2[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))];
|
$vol = $tab_pomp2[$while_date] - $tab_pomp2[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))];
|
||||||
$Nbjours_P2++;
|
$Nbjours_P2++;
|
||||||
}
|
}
|
||||||
@ -169,8 +154,7 @@ for($i = 0; $i < $Nbjours+1; $i++)//On remplie s_pomp2 des valeurs de la bdd pou
|
|||||||
|
|
||||||
$s_pomp2 = $s_pomp2 . $vol . ','; //On ajoute la valeur au tableau
|
$s_pomp2 = $s_pomp2 . $vol . ','; //On ajoute la valeur au tableau
|
||||||
|
|
||||||
}
|
} else if ($i != 0) $s_pomp2 = $s_pomp2 . 'null,'; //Si aucune valeur on met null dans le tableau
|
||||||
else if ($i != 0) $s_pomp2 = $s_pomp2.'null,'; //Si aucune valeur on met null dans le tableau
|
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,6 +276,5 @@ $(function () {
|
|||||||
<?php
|
<?php
|
||||||
if ($voltot == 0) $volmin = 0;
|
if ($voltot == 0) $volmin = 0;
|
||||||
echo "Volume pompé --- V total = <b>" . round($voltot, 2) . "</b> m³ -- Tmoy/jour = <b>" . round($vmoy, 2) . "</b> m³ (" . $Nbjours_V1 . "J) -- Tmin = <b>" . round($volmin, 2) . "</b> m³ -- TMax = <b>" . round($volmax, 2) . "</b> m³ --- ";
|
echo "Volume pompé --- V total = <b>" . round($voltot, 2) . "</b> m³ -- Tmoy/jour = <b>" . round($vmoy, 2) . "</b> m³ (" . $Nbjours_V1 . "J) -- Tmin = <b>" . round($volmin, 2) . "</b> m³ -- TMax = <b>" . round($volmax, 2) . "</b> m³ --- ";
|
||||||
}
|
} else echo 'Vous n\'êtes pas autorisé/connecté!';
|
||||||
else echo 'Vous n\'êtes pas autorisé/connecté!';
|
|
||||||
include('foot.php'); ?>
|
include('foot.php'); ?>
|
@ -1,6 +1,5 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['droit'] > 0)
|
if (@$infos_user['droit'] > 0) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<script src="js/highcharts.js"></script>
|
<script src="js/highcharts.js"></script>
|
||||||
<script src="js/modules/exporting.js"></script>
|
<script src="js/modules/exporting.js"></script>
|
||||||
@ -18,8 +17,7 @@ if(isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET[
|
|||||||
$date1 = date("Y-m-d", strtotime("-1 day", strtotime($_GET['du']))); // On enlève 1 jour à la date de départ et on converti en date le timestamp
|
$date1 = date("Y-m-d", strtotime("-1 day", strtotime($_GET['du']))); // On enlève 1 jour à la date de départ et on converti en date le timestamp
|
||||||
$date1bis = date('Y-m-d', strtotime($_GET['du']));
|
$date1bis = date('Y-m-d', strtotime($_GET['du']));
|
||||||
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
||||||
}
|
} else //Sinon on prend les valeurs du dernier mois
|
||||||
else //Sinon on prend les valeurs du dernier mois
|
|
||||||
{
|
{
|
||||||
$date1bis = $date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d')))); // On soustrait 1 mois (pour pouvoir effectuer un calcul plus tard)
|
$date1bis = $date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d')))); // On soustrait 1 mois (pour pouvoir effectuer un calcul plus tard)
|
||||||
$date2 = date('Y-m-d', strtotime("+1 day", strtotime(date('Y-m-d'))));
|
$date2 = date('Y-m-d', strtotime("+1 day", strtotime(date('Y-m-d'))));
|
||||||
@ -30,15 +28,13 @@ $result_vol_6 = $connexion->query("SELECT * FROM surpresseur WHERE heure='00:15:
|
|||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
$s_date = ''; // On initialise
|
$s_date = ''; // On initialise
|
||||||
|
|
||||||
while(strtotime($while_date) <= strtotime($date2))
|
while (strtotime($while_date) <= strtotime($date2)) {
|
||||||
{
|
|
||||||
$tab_vol_6[$while_date] = 'null';
|
$tab_vol_6[$while_date] = 'null';
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$while_datebis = $date1bis;
|
$while_datebis = $date1bis;
|
||||||
while(strtotime($while_datebis) <= strtotime($date2))
|
while (strtotime($while_datebis) <= strtotime($date2)) {
|
||||||
{
|
|
||||||
$s_date = $s_date . '"' . date("d/m/y", strtotime($while_datebis)) . '",';
|
$s_date = $s_date . '"' . date("d/m/y", strtotime($while_datebis)) . '",';
|
||||||
$while_datebis = date("Y-m-d", strtotime("+1 day", strtotime($while_datebis)));
|
$while_datebis = date("Y-m-d", strtotime("+1 day", strtotime($while_datebis)));
|
||||||
}
|
}
|
||||||
@ -58,18 +54,14 @@ $Nbjours_V1=0;
|
|||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
for ($i = 0; $i < count($tab_vol_6); $i++) //On remplie s_vol_6 des valeurs de la bdd pour highchart
|
for ($i = 0; $i < count($tab_vol_6); $i++) //On remplie s_vol_6 des valeurs de la bdd pour highchart
|
||||||
{
|
{
|
||||||
if(isset($tab_vol_6[$while_date]) && $tab_vol_6[$while_date] != 'null' and $i != 0)
|
if (isset($tab_vol_6[$while_date]) && $tab_vol_6[$while_date] != 'null' and $i != 0) {
|
||||||
{
|
|
||||||
if ($tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))] == 'null') //On vérifie que la valeur précédente éxiste
|
if ($tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))] == 'null') //On vérifie que la valeur précédente éxiste
|
||||||
if($tab_vol_6[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))] != 'null')
|
if ($tab_vol_6[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))] != 'null') {
|
||||||
{
|
|
||||||
$vol = $tab_vol_6[$while_date] - $tab_vol_6[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))];
|
$vol = $tab_vol_6[$while_date] - $tab_vol_6[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))];
|
||||||
$Nbjours_V1++; //Compte le nombre de jours avec valeur
|
$Nbjours_V1++; //Compte le nombre de jours avec valeur
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$vol = '0';
|
$vol = '0';
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
$vol = $tab_vol_6[$while_date] - $tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))];
|
$vol = $tab_vol_6[$while_date] - $tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))];
|
||||||
$Nbjours_V1++; //Compte le nombre de jours avec valeur
|
$Nbjours_V1++; //Compte le nombre de jours avec valeur
|
||||||
}
|
}
|
||||||
@ -80,8 +72,7 @@ for($i = 0; $i < count($tab_vol_6); $i++)//On remplie s_vol_6 des valeurs de la
|
|||||||
$voltot = $voltot + $vol;
|
$voltot = $voltot + $vol;
|
||||||
|
|
||||||
$s_vol_6 = $s_vol_6 . $vol . ','; //On ajoute la valeur au tableau
|
$s_vol_6 = $s_vol_6 . $vol . ','; //On ajoute la valeur au tableau
|
||||||
}
|
} else if ($i != 0) $s_vol_6 = $s_vol_6 . 'null,';
|
||||||
else if ($i != 0) $s_vol_6 = $s_vol_6.'null,';
|
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,18 +104,14 @@ $Nbjours_P1=0;
|
|||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
for ($i = 0; $i < $Nbjours + 1; $i++) //On remplie $s_pomp1 des valeurs de la bdd pour highchart
|
for ($i = 0; $i < $Nbjours + 1; $i++) //On remplie $s_pomp1 des valeurs de la bdd pour highchart
|
||||||
{
|
{
|
||||||
if(isset($tab_pomp1[$while_date]) && $tab_pomp1[$while_date] != 'null' and $i != 0)
|
if (isset($tab_pomp1[$while_date]) && $tab_pomp1[$while_date] != 'null' and $i != 0) {
|
||||||
{
|
|
||||||
if (!isset($tab_pomp1[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))])) //On vérifie que la valeur précédente éxiste
|
if (!isset($tab_pomp1[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))])) //On vérifie que la valeur précédente éxiste
|
||||||
if(isset($tab_pomp1[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))]))
|
if (isset($tab_pomp1[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))])) {
|
||||||
{
|
|
||||||
$vol = $tab_pomp1[$while_date] - $tab_pomp1[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))];
|
$vol = $tab_pomp1[$while_date] - $tab_pomp1[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))];
|
||||||
$Nbjours_P1++; //Compte le nombre de jours avec valeur
|
$Nbjours_P1++; //Compte le nombre de jours avec valeur
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$vol = '0';
|
$vol = '0';
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
$vol = $tab_pomp1[$while_date] - $tab_pomp1[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))];
|
$vol = $tab_pomp1[$while_date] - $tab_pomp1[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))];
|
||||||
$Nbjours_P1++; //Compte le nombre de jours avec valeur
|
$Nbjours_P1++; //Compte le nombre de jours avec valeur
|
||||||
}
|
}
|
||||||
@ -136,8 +123,7 @@ for($i = 0; $i < $Nbjours+1; $i++)//On remplie $s_pomp1 des valeurs de la bdd p
|
|||||||
|
|
||||||
$s_pomp1 = $s_pomp1 . $vol . ','; //On ajoute la valeur au tableau
|
$s_pomp1 = $s_pomp1 . $vol . ','; //On ajoute la valeur au tableau
|
||||||
|
|
||||||
}
|
} else if ($i != 0) $s_pomp1 = $s_pomp1 . 'null,';
|
||||||
else if ($i != 0) $s_pomp1 = $s_pomp1.'null,';
|
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,18 +135,14 @@ $Nbjours_P2=0;
|
|||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
for ($i = 0; $i < $Nbjours + 1; $i++) //On remplie $s_pomp2 des valeurs de la bdd pour highchart
|
for ($i = 0; $i < $Nbjours + 1; $i++) //On remplie $s_pomp2 des valeurs de la bdd pour highchart
|
||||||
{
|
{
|
||||||
if(isset($tab_pomp2[$while_date]) && $tab_pomp2[$while_date] != 'null' and $i != 0)
|
if (isset($tab_pomp2[$while_date]) && $tab_pomp2[$while_date] != 'null' and $i != 0) {
|
||||||
{
|
|
||||||
if (!isset($tab_pomp2[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))])) //On vérifie que la valeur précédente éxiste
|
if (!isset($tab_pomp2[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))])) //On vérifie que la valeur précédente éxiste
|
||||||
if(isset($tab_pomp2[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))]))
|
if (isset($tab_pomp2[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))])) {
|
||||||
{
|
|
||||||
$vol = $tab_pomp2[$while_date] - $tab_pomp2[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))];
|
$vol = $tab_pomp2[$while_date] - $tab_pomp2[date("Y-m-d", strtotime("-2 day", strtotime($while_date)))];
|
||||||
$Nbjours_P2++; //Compte le nombre de jours avec valeur
|
$Nbjours_P2++; //Compte le nombre de jours avec valeur
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$vol = '0';
|
$vol = '0';
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
$vol = $tab_pomp2[$while_date] - $tab_pomp2[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))];
|
$vol = $tab_pomp2[$while_date] - $tab_pomp2[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))];
|
||||||
$Nbjours_P2++; //Compte le nombre de jours avec valeur
|
$Nbjours_P2++; //Compte le nombre de jours avec valeur
|
||||||
}
|
}
|
||||||
@ -172,8 +154,7 @@ for($i = 0; $i < $Nbjours+1; $i++)//On remplie $s_pomp2 des valeurs de la bdd p
|
|||||||
|
|
||||||
$s_pomp2 = $s_pomp2 . $vol . ','; //On ajoute la valeur au tableau
|
$s_pomp2 = $s_pomp2 . $vol . ','; //On ajoute la valeur au tableau
|
||||||
|
|
||||||
}
|
} else if ($i != 0) $s_pomp2 = $s_pomp2 . 'null,';
|
||||||
else if ($i != 0) $s_pomp2 = $s_pomp2.'null,';
|
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +276,5 @@ $(function () {
|
|||||||
<?php
|
<?php
|
||||||
if ($voltot == 0) $volmin = 0;
|
if ($voltot == 0) $volmin = 0;
|
||||||
echo "Volume pompé --- V total = <b>" . round($voltot, 2) . "</b> m³ -- Tmoy/jour = <b>" . round($vmoy, 2) . "</b> m³ (" . $Nbjours_V1 . "J) -- Tmin = <b>" . round($volmin, 2) . "</b> m³ -- TMax = <b>" . round($volmax, 2) . "</b> m³ --- ";
|
echo "Volume pompé --- V total = <b>" . round($voltot, 2) . "</b> m³ -- Tmoy/jour = <b>" . round($vmoy, 2) . "</b> m³ (" . $Nbjours_V1 . "J) -- Tmin = <b>" . round($volmin, 2) . "</b> m³ -- TMax = <b>" . round($volmax, 2) . "</b> m³ --- ";
|
||||||
|
} else echo 'Vous n\'êtes pas autorisé/connecté!';
|
||||||
}
|
|
||||||
else echo 'Vous n\'êtes pas autorisé/connecté!';
|
|
||||||
include('foot.php'); ?>
|
include('foot.php'); ?>
|
@ -1,6 +1,5 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['droit'] > 0)
|
if (@$infos_user['droit'] > 0) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<script src="js/highcharts.js"></script>
|
<script src="js/highcharts.js"></script>
|
||||||
<script src="js/modules/exporting.js"></script>
|
<script src="js/modules/exporting.js"></script>
|
||||||
@ -13,13 +12,10 @@ if(@$infos_user['droit'] > 0)
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET['au']))
|
if (isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET['au'])) {
|
||||||
{
|
|
||||||
$date1 = date('Y-m-d', strtotime($_GET['du']));
|
$date1 = date('Y-m-d', strtotime($_GET['du']));
|
||||||
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
$date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
||||||
$date2 = date('Y-m-d');
|
$date2 = date('Y-m-d');
|
||||||
}
|
}
|
||||||
@ -30,8 +26,7 @@ $while_date = $date1;
|
|||||||
|
|
||||||
$s_date = '';
|
$s_date = '';
|
||||||
|
|
||||||
while(strtotime($while_date) <= strtotime($date2))
|
while (strtotime($while_date) <= strtotime($date2)) {
|
||||||
{
|
|
||||||
$tab_amb[$while_date] = 'null';
|
$tab_amb[$while_date] = 'null';
|
||||||
$tab_col[$while_date] = 'null';
|
$tab_col[$while_date] = 'null';
|
||||||
|
|
||||||
@ -39,8 +34,7 @@ while(strtotime($while_date) <= strtotime($date2))
|
|||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
while($fetch = $result_temp->fetch())
|
while ($fetch = $result_temp->fetch()) {
|
||||||
{
|
|
||||||
$tab_amb[$fetch['date']] = $fetch['temp_ambiante'];
|
$tab_amb[$fetch['date']] = $fetch['temp_ambiante'];
|
||||||
$tab_col[$fetch['date']] = $fetch['temp_colonne'];
|
$tab_col[$fetch['date']] = $fetch['temp_colonne'];
|
||||||
}
|
}
|
||||||
@ -56,8 +50,7 @@ $temp_coltot = 0;
|
|||||||
|
|
||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
|
|
||||||
for($i = 0; $i < count($tab_amb); $i++)
|
for ($i = 0; $i < count($tab_amb); $i++) {
|
||||||
{
|
|
||||||
// recherche mini et Maxi calcul total
|
// recherche mini et Maxi calcul total
|
||||||
$temp_amb = $tab_amb[$while_date];
|
$temp_amb = $tab_amb[$while_date];
|
||||||
$temp_col = $tab_col[$while_date];
|
$temp_col = $tab_col[$while_date];
|
||||||
@ -142,6 +135,5 @@ $(function () {
|
|||||||
|
|
||||||
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
|
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
} else echo 'Vous n\'êtes pas autorisé/connecté!';
|
||||||
else echo 'Vous n\'êtes pas autorisé/connecté!';
|
|
||||||
include('foot.php'); ?>
|
include('foot.php'); ?>
|
40
volumes.php
40
volumes.php
@ -1,6 +1,5 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['droit'] > 0)
|
if (@$infos_user['droit'] > 0) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<script src="js/highcharts.js"></script>
|
<script src="js/highcharts.js"></script>
|
||||||
<script src="js/modules/exporting.js"></script>
|
<script src="js/modules/exporting.js"></script>
|
||||||
@ -13,13 +12,10 @@ if(@$infos_user['droit'] > 0)
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET['au']))
|
if (isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET['au'])) {
|
||||||
{
|
|
||||||
$date1 = date('Y-m-d', strtotime($_GET['du']));
|
$date1 = date('Y-m-d', strtotime($_GET['du']));
|
||||||
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
$date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
||||||
$date2 = date('Y-m-d');
|
$date2 = date('Y-m-d');
|
||||||
}
|
}
|
||||||
@ -31,8 +27,7 @@ $while_date = $date1;
|
|||||||
|
|
||||||
$s_date = '';
|
$s_date = '';
|
||||||
|
|
||||||
while(strtotime($while_date) <= strtotime($date2))
|
while (strtotime($while_date) <= strtotime($date2)) {
|
||||||
{
|
|
||||||
$tab_vol_6[$while_date] = 'null';
|
$tab_vol_6[$while_date] = 'null';
|
||||||
$tab_vol_22[$while_date] = 'null';
|
$tab_vol_22[$while_date] = 'null';
|
||||||
|
|
||||||
@ -40,12 +35,10 @@ while(strtotime($while_date) <= strtotime($date2))
|
|||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
while($fetch = $result_vol_6->fetch())
|
while ($fetch = $result_vol_6->fetch()) {
|
||||||
{
|
|
||||||
$tab_vol_6[$fetch['date']] = $fetch['compteur_impulsion'];
|
$tab_vol_6[$fetch['date']] = $fetch['compteur_impulsion'];
|
||||||
}
|
}
|
||||||
while($fetch = $result_vol_22->fetch())
|
while ($fetch = $result_vol_22->fetch()) {
|
||||||
{
|
|
||||||
$tab_vol_22[$fetch['date']] = $fetch['compteur_impulsion'];
|
$tab_vol_22[$fetch['date']] = $fetch['compteur_impulsion'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,10 +49,8 @@ $volmax = 0;
|
|||||||
$voltot = 0;
|
$voltot = 0;
|
||||||
|
|
||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
for($i = 0; $i < count($tab_vol_6); $i++)
|
for ($i = 0; $i < count($tab_vol_6); $i++) {
|
||||||
{
|
if (isset($tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]) && $tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))] != 'null' && $tab_vol_6[$while_date] != 'null') {
|
||||||
if(isset($tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]) && $tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))] != 'null' && $tab_vol_6[$while_date] != 'null')
|
|
||||||
{
|
|
||||||
$vol = ($tab_vol_6[$while_date] - $tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]);
|
$vol = ($tab_vol_6[$while_date] - $tab_vol_22[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]);
|
||||||
// recherche mini et Maxi calcul total
|
// recherche mini et Maxi calcul total
|
||||||
if ($vol < $volmin) $volmin = $vol;
|
if ($vol < $volmin) $volmin = $vol;
|
||||||
@ -67,16 +58,13 @@ for($i = 0; $i < count($tab_vol_6); $i++)
|
|||||||
$voltot = $voltot + $vol;
|
$voltot = $voltot + $vol;
|
||||||
|
|
||||||
$s_vol_6 = $s_vol_6 . $vol . ',';
|
$s_vol_6 = $s_vol_6 . $vol . ',';
|
||||||
}
|
} else $s_vol_6 = $s_vol_6 . 'null,';
|
||||||
else $s_vol_6 = $s_vol_6.'null,';
|
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
for($i = 0; $i < count($tab_vol_22); $i++)
|
for ($i = 0; $i < count($tab_vol_22); $i++) {
|
||||||
{
|
if ($tab_vol_22[$while_date] != 'null' && $tab_vol_6[$while_date] != 'null') {
|
||||||
if($tab_vol_22[$while_date] != 'null' && $tab_vol_6[$while_date] != 'null')
|
|
||||||
{
|
|
||||||
$vol = ($tab_vol_22[$while_date] - $tab_vol_6[$while_date]);
|
$vol = ($tab_vol_22[$while_date] - $tab_vol_6[$while_date]);
|
||||||
// recherche mini et Maxi calcul total
|
// recherche mini et Maxi calcul total
|
||||||
if ($vol < $volmin) $volmin = $vol;
|
if ($vol < $volmin) $volmin = $vol;
|
||||||
@ -84,8 +72,7 @@ for($i = 0; $i < count($tab_vol_22); $i++)
|
|||||||
$voltot = $voltot + $vol;
|
$voltot = $voltot + $vol;
|
||||||
|
|
||||||
$s_vol_22 = $s_vol_22 . $vol . ',';
|
$s_vol_22 = $s_vol_22 . $vol . ',';
|
||||||
}
|
} else $s_vol_22 = $s_vol_22 . 'null,';
|
||||||
else $s_vol_22 = $s_vol_22.'null,';
|
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +163,5 @@ $(function () {
|
|||||||
|
|
||||||
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
|
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
} else echo 'Vous n\'êtes pas autorisé/connecté!';
|
||||||
else echo 'Vous n\'êtes pas autorisé/connecté!';
|
|
||||||
include('foot.php'); ?>
|
include('foot.php'); ?>
|
@ -1,6 +1,5 @@
|
|||||||
<?php require('head.php');
|
<?php require('head.php');
|
||||||
if(@$infos_user['droit'] > 0)
|
if (@$infos_user['droit'] > 0) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<script src="js/highcharts.js"></script>
|
<script src="js/highcharts.js"></script>
|
||||||
<script src="js/modules/exporting.js"></script>
|
<script src="js/modules/exporting.js"></script>
|
||||||
@ -13,13 +12,10 @@ if(@$infos_user['droit'] > 0)
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET['au']))
|
if (isset($_GET['du'], $_GET['au']) && strtotime($_GET['du']) && strtotime($_GET['au'])) {
|
||||||
{
|
|
||||||
$date1 = date('Y-m-d', strtotime($_GET['du']));
|
$date1 = date('Y-m-d', strtotime($_GET['du']));
|
||||||
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
$date2 = date('Y-m-d', strtotime($_GET['au']));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
$date1 = date('Y-m-d', strtotime("-1 month", strtotime(date('Y-m-d'))));
|
||||||
$date2 = date('Y-m-d');
|
$date2 = date('Y-m-d');
|
||||||
}
|
}
|
||||||
@ -30,16 +26,14 @@ $while_date = $date1;
|
|||||||
|
|
||||||
$s_date = '';
|
$s_date = '';
|
||||||
|
|
||||||
while(strtotime($while_date) <= strtotime($date2))
|
while (strtotime($while_date) <= strtotime($date2)) {
|
||||||
{
|
|
||||||
$tab_vol_6[$while_date] = 'null';
|
$tab_vol_6[$while_date] = 'null';
|
||||||
|
|
||||||
$s_date = $s_date . '"' . date("d/m/y", strtotime($while_date)) . '",';
|
$s_date = $s_date . '"' . date("d/m/y", strtotime($while_date)) . '",';
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
while($fetch = $result_vol_6->fetch())
|
while ($fetch = $result_vol_6->fetch()) {
|
||||||
{
|
|
||||||
$tab_vol_6[$fetch['date']] = $fetch['volume'];
|
$tab_vol_6[$fetch['date']] = $fetch['volume'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,18 +43,15 @@ $volmax = 0;
|
|||||||
$voltot = 0;
|
$voltot = 0;
|
||||||
|
|
||||||
$while_date = $date1;
|
$while_date = $date1;
|
||||||
for($i = 0; $i < count($tab_vol_6); $i++)
|
for ($i = 0; $i < count($tab_vol_6); $i++) {
|
||||||
{
|
if (isset($tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]) && $tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))] != 'null' && $tab_vol_6[$while_date] != 'null') {
|
||||||
if(isset($tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]) && $tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))] != 'null' && $tab_vol_6[$while_date] != 'null')
|
|
||||||
{
|
|
||||||
// recherche mini et Maxi calcul total
|
// recherche mini et Maxi calcul total
|
||||||
$vol = ($tab_vol_6[$while_date] - $tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]);
|
$vol = ($tab_vol_6[$while_date] - $tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]);
|
||||||
if ($vol < $volmin) $volmin = $vol;
|
if ($vol < $volmin) $volmin = $vol;
|
||||||
if ($vol > $volmax) $volmax = $vol;
|
if ($vol > $volmax) $volmax = $vol;
|
||||||
$voltot = $voltot + $vol;
|
$voltot = $voltot + $vol;
|
||||||
$s_vol_6 = $s_vol_6 . $vol . ',';
|
$s_vol_6 = $s_vol_6 . $vol . ',';
|
||||||
}
|
} else $s_vol_6 = $s_vol_6 . 'null,';
|
||||||
else $s_vol_6 = $s_vol_6.'null,';
|
|
||||||
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
$while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +120,5 @@ $(function () {
|
|||||||
|
|
||||||
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
|
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
} else echo 'Vous n\'êtes pas autorisé/connecté!';
|
||||||
else echo 'Vous n\'êtes pas autorisé/connecté!';
|
|
||||||
include('foot.php'); ?>
|
include('foot.php'); ?>
|
Reference in New Issue
Block a user