1 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
 
   4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
 
   5   <meta http-equiv="Refresh" content="60"> 
 
   6   <meta name="GENERATOR" content="Mozilla/4.72 (X11; U; Linux 2.2.12-20smp i686) [Netscape]">    
 
   7   <title>WeatherMon (Последние 24 часа)</title>                      
 
   8   <link rel="icon" href="favicon.png" />
 
   9   <style type="text/css">
 
  10      a:visited { text-decoration: none; color:darkblue; }
 
  11      a:link { text-decoration: none; color:blue; }
 
  12      a:hover { text-decoration: none; color:navy; }
 
  13      .header { font-size: 16; float: left; margin: 10px;}
 
  14      .timestamp { font-size: 16; margin: 10px;}
 
  15      .value { font-size: 60; margin: 10px; }
 
  16      .block { float: left; margin: 20px; }
 
  17      .container { clear: both; }
 
  18      .footer { clear: both; margin: 20px; font-size: 20; }
 
  22 <div class="container">
 
  25 include('config_local.php');
 
  28 if (! ($db = new PDO("mysql:host=$mysql_host;port=$mysql_port;dbname=$mysql_schema",$mysql_user,$mysql_pwd,array( PDO::ATTR_PERSISTENT => false)))) {
 
  32 $db -> exec('SET CHARACTER SET utf8');
 
  36     distinct v.sensor_id,s.s_description,p.id as param_id,p.st_description 
 
  38     sensor_values v,st_parameters p,sensors s 
 
  40     v.timestamp>adddate(now(), -1) 
 
  44   order by s_description,st_description'
 
  48 while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
 
  50   echo '<div class="block">';
 
  51   echo '<div class="header">'.$row['s_description'].'/'.$row['st_description'].'</div>';
 
  55     SELECT unix_timestamp(timestamp) timestamp,DATE_FORMAT(timestamp,"%H:%i") printable,value
 
  59       sensor_id='.$row['sensor_id'].' and parameter_id='.$row['param_id'].' and timestamp>addtime(now(), -3600)
 
  70 if ($rowl = $ql -> fetch(PDO::FETCH_ASSOC)) {
 
  72   $timestamp = $rowl['timestamp'];
 
  73   $printable_ts = $rowl['printable'];
 
  74   $value = $rowl['value'];
 
  76   $units = get_unit($db,$row['param_id']);
 
  77   $from_unit = $units['from'];
 
  78   $to_unit = $units['to'];
 
  79   $param_unit = $units['name'];
 
  81   $val = convert_unit($db,$value,$from_unit,$to_unit);
 
  85 echo '<div class="timestamp">'.$printable_ts.'</div>';
 
  86 echo '<div class="value">'.$val.' '.$param_unit.'</div>';
 
  88 <div class="graph"><img src="image.php?sensor=<?php echo $row['sensor_id']; ?>¶m=<?php echo $row['param_id']?>&type=last24small"></div>
 
  98 <a href="archive.php">Архивные данные</a>
 
  99 <a href="graphs.php">Подробные графики</a>
 
 100 <a href="setup.php">Настройки</a>