graphique.php 1.51 KB
<?php
session_start();
require_once("accesBase.php");
$nom = $_POST['nom'];
$nombre = $_POST['nombre'];
$start = $_POST['start-date'];
$end = $_POST['end-date'];
if(($end == NULL) || ($end < $start)) {$e = date_max(); $end = $e['max'];}
else $end = $end." 23:59:59";
if($start == NULL) {$s = date_min(); $start = $s['min'];}
else $start = $start."  00:00:00";
?>
<!DOCTYPE html>

<html>
        <head>
                <?php include("head.php"); ?>
        </head>

        <!-- Contenu du site -->
        <body>
                <?php 
                include("header.php");
                if(isset($_SESSION['Login'], $_SESSION['Password']))
                {
                        ?>
			<div class="row">
				<div class="col-10 col-md-10 offset-md-1 offset-1">
					<br/>
					<h1 style="margin-bottom:20px; margin-top:60px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fas fa-chart-line"></i> Graphe du capteur</h1>
					<?php
					if(historyExist($nom) && $nombre > 1)
					{
						echo "<img src='graphe.php?nom=$nom&nombre=$nombre&start=$start&end=$end' alt='graphe'>";
					}
					else
					{
						?>
						<div class="alert alert-danger" role="alert">
							Il n'y a pas assez de valeurs pour ce capteur !
						</div>
						<meta http-equiv="Refresh" content="5;url=rechercheGraphe.php" />
						<?php
					}
					?>
				</div>
			</div>
			<?php
                }
                else
                {
                        include("formConnexion.php");
                }
                ?>
        </body>
</html>