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: underline; 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 $client_ip = $_SERVER["REMOTE_ADDR"];
27 if ((strpos($client_ip, "192.168.") === 0) || (strpos($client_ip, "10.8.") === 0)
28 || (strpos($client_ip, "2a02:578:5002:8174:") === 0)
29 || (strpos($client_ip, "2a02:578:5002:196::2") === 0)) {
39 include('config_local.php');
42 if (! ($db = new PDO("mysql:host=$mysql_host;port=$mysql_port;dbname=$mysql_schema",$mysql_user,$mysql_pwd,array( PDO::ATTR_PERSISTENT => false)))) {
46 $db -> exec('SET CHARACTER SET utf8');
50 $filter = ' and s.is_public=1';
60 distinct v.sensor_id,s.s_description,p.id as param_id,p.st_description
62 sensor_values v,st_parameters p,sensors s
64 v.timestamp>adddate(now(), -1)
66 and v.parameter_id=p.id
68 and p.id>=0'.$filter.'
69 order by s_description,st_description'
73 while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
75 echo '<div class="block">';
76 echo '<div class="header">'.$row['s_description'].'/'.$row['st_description'].'</div>';
80 SELECT unix_timestamp(timestamp) timestamp,DATE_FORMAT(timestamp,"%H:%i") printable,value
84 sensor_id='.$row['sensor_id'].' and parameter_id='.$row['param_id'].' and timestamp>addtime(now(), -3600)
95 if ($rowl = $ql -> fetch(PDO::FETCH_ASSOC)) {
97 $timestamp = $rowl['timestamp'];
98 $printable_ts = $rowl['printable'];
99 $value = $rowl['value'];
101 $units = get_unit($db,$row['param_id']);
102 $from_unit = $units['from'];
103 $to_unit = $units['to'];
104 $param_unit = $units['name'];
106 $val = convert_unit($db,$value,$from_unit,$to_unit);
110 if ($printable_ts != '?') {
111 echo '<div class="timestamp">'.$printable_ts.'</div>';
112 echo '<div class="value">'.$val.' '.$param_unit.'</div>';
115 <div class="graph"><a href="image.php?sensor=<?php echo $row['sensor_id']; ?>¶m=<?php echo $row['param_id']?>&type=last24"><img src="image.php?sensor=<?php echo $row['sensor_id']; ?>¶m=<?php echo $row['param_id']?>&type=last24small"></a></div>
125 <a href="archive.php">Архивные данные</a>
126 <a href="graphs.php">Подробные графики</a>
127 <a href="setup.php">Настройки</a>