<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
  <meta name="GENERATOR" content="Mozilla/4.72 (X11; U; Linux 2.2.12-20smp i686) [Netscape]">    
  <title>WeatherMon (Последние 24 часа)</title>                      
  <link rel="icon" href="favicon.png" />
  <style type="text/css">
     a:visited { text-decoration: none; color:darkblue; }
     a:link { text-decoration: none; color:blue; }
     a:hover { text-decoration: none; color:navy; }
  </style>
</head>
<body text="black" bgcolor="silver" link="blue" vlink="#000080" alink="#FF0000">         
<?php

include('config_local.php');

if (! ($db = new PDO("mysql:host=$mysql_host;port=$mysql_port;dbname=$mysql_schema",$mysql_user,$mysql_pwd,array( PDO::ATTR_PERSISTENT => false)))) {
  die($err);
  }  

$db -> exec('SET CHARACTER SET utf8');

$q = $db -> prepare(
  'select 
    distinct v.sensor_id,s.s_description,p.id as param_id,p.st_description 
  from 
    sensor_values v,st_parameters p,sensors s 
  where 
    v.timestamp>adddate(now(), -1) 
    and v.sensor_id=s.id 
    and s.st_id=p.st_id
    and p.id>=0
  order by s_description,st_description'
  );
$q -> execute();

while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {

  echo '<h3 align="center">'.$row['s_description'].'/'.$row['st_description'].'</h3>';
?>
<center><img src="image.php?sensor=<?php echo $row['sensor_id']; ?>&param=<?php echo $row['param_id']?>&type=last24"></center>
<?php  

}                                                            
  
?>
<a href="archive.php">Архивные данные</a>
<br>
<a href="setup.php">Настройки</a>
</body>