Веб переделан/
authorRoman Bazalevsky <rvb@rvb.name>
Thu, 29 Nov 2018 18:00:14 +0000 (21:00 +0300)
committerRoman Bazalevsky <rvb@rvb.name>
Thu, 29 Nov 2018 18:00:14 +0000 (21:00 +0300)
web/archive.php [deleted file]
web/calendar.php [deleted file]
web/favicon.png [deleted file]
web/favicon.svg [deleted file]
web/graphs.php [deleted file]
web/image.php [deleted file]
web/image_minmax.php [deleted file]
web/index.php [deleted file]
web/setup.php [deleted file]
web/units.php [deleted file]

diff --git a/web/archive.php b/web/archive.php
deleted file mode 100644 (file)
index 1b21599..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-<!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 (архив)</title>                      
-  <link rel="icon" href="favicon.png" />
-  <style type="text/css">
-    a.year   {
-        padding:20px;
-        margin: 10px;
-        border:2px solid darkgrey;
-        border-radius: 10px;
-        display:inline-block;
-        width:200px;
-        float:left;
-        font-size:100%;
-        text-align:center;
-    }                                          
-    a.month   {
-        font-size:100%;
-        text-align:center;
-    }                                          
-    a:visited { text-decoration: none; color:darkblue; }
-    a:link { text-decoration: none; color:blue; }
-    a:hover { text-decoration: underline; color:navy; }  
-  </style>
-</head>
-<body text="black" bgcolor="silver" link="blue" vlink="#000080" alink="#FF0000">         
-<?php
-
-include('config_local.php');
-include('calendar.php');
-include('units.php');
-
-  $client_ip = $_SERVER["REMOTE_ADDR"];
-
-  if ((strpos($client_ip, "192.168.") === 0) || (strpos($client_ip, "10.8.") === 0)
-     || (strpos($client_ip, "2a02:578:5002:8174:") === 0)
-     || (strpos($client_ip, "2a02:578:5002:196::2") === 0)) {
-
-    $local_net = True;
-
-  } else {
-
-    $local_net = False;
-
-  }
-
-
-$year = $_REQUEST['year']; 
-$month = $_REQUEST['month'];
-$day = $_REQUEST['day'];
-
-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');
-
-if (! $year) {
-        
-  $q = $db -> prepare(
-    'select 
-       date_format(day,\'%Y\') as year
-     from 
-       calendar
-     group by year  
-     order by year');
-  $q -> execute();
-?>
-<h1>Архив метеоданных</h1>
-<?php
-  while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-?> 
-  <a class="year" href="?year=<?php echo $row['year']; ?>">Данные за <?php echo $row['year']; ?> год</a>
-<?php
-  }
-      
-} else {
-
-  if (! $month) {
-      
-    $next_year = $year+1;
-    $year      = sprintf('%04d',$year);
-    $next_year = sprintf('%04d',$next_year);
-    $q = $db -> prepare(
-          'select 
-             date_format(day,\'%m\') as month,
-             date_format(day,\'%d\') as day
-           from 
-             calendar
-           where 
-             day>=str_to_date(\''.$year.'-01-01\',\'%Y-%m-%d\') and 
-             day<str_to_date(\''.$next_year.'-01-01\',\'%Y-%m-%d\')
-           group by month,day
-           order by month,day'
-          );
-    $q -> execute();
-?>
-<h1 align="center"><?php echo $year; ?> год</h1>
-<?php
-    $data = $q -> fetchAll(PDO::FETCH_ASSOC);
-    $months = [];
-    foreach ($data as $row) {
-      $days [$year.$row['month'].$row['day']] = '&month='.$row['month'].'&day='.$row['day'];
-      $months[$row['month']]=1;
-    }
-    $m = 1;
-    echo '<table align="center">';
-    for ($i=1; $i<=3; $i++) {
-      echo '<tr>';
-      for ($j=1; $j<=4; $j++) {
-        echo '<td valign="top">';
-        $month=sprintf('%02d',$m);
-        $month_name = strftime('%B',mktime(0,0,0,$month,1,$year));
-        if (!empty($months[$month])) {
-          echo '<h3 align="center"><a class="month" href="?year='.$year.'&month='.$month.'">'.$month_name.'</a></h3>';
-        } else {
-          echo '<h3 align="center">'.$month_name.'</h3>';
-        }
-        calendar($year,$month,$days,'?year='.$year.'%s',0);
-        echo '</td>';
-        $m++;
-        }
-      echo '</tr>';
-    }
-    echo '</table>';
-    
-    $next_year = $year+1;
-
-    if (!$local_net) {
-
-      $filter = ' and s.is_public=1';
-  
-    } else {
-  
-      $filter = '';
-    
-    }  
-    
-    
-
-    $q = $db -> prepare (
-      'select 
-         s.id sensor,p.id param,s.s_description sensor_name,p.st_description param_name,
-         count(distinct day) cnt,
-         round(min(v.min),1) min_value,
-         round(max(v.max),1) max_value,
-         u.name_short unit
-       from
-         sensors_ranges v,sensors s,st_parameters p,units u
-       where 
-         v.sensor=s.id and
-         v.parameter=p.id and
-         p.st_unit=u.id and
-         v.day>=str_to_date(\''.$year.'-01-01\',\'%Y-%m-%d\') and 
-         v.day<str_to_date(\''.$next_year.'-01-01\',\'%Y-%m-%d\''.$filter.')
-      group by s.id,p.id,s.s_description,p.st_description
-      order by s.id,p.id'
-      );
-        
-    $q -> execute();
-    $sensors = $q -> fetchAll(PDO::FETCH_ASSOC);
-      
-    foreach ($sensors as $sensor) {
-
-      $units = get_unit($db,$sensor['param']);
-      $from_unit = $units['from'];
-      $to_unit = $units['to'];
-      $param_unit = $units['name'];
-
-      $min_val = convert_unit($db,$sensor['min_value'],$from_unit,$to_unit);
-      $max_val = convert_unit($db,$sensor['max_value'],$from_unit,$to_unit);
-     
-      echo '<h3 align="center">'.$sensor['param_name'].'('.$sensor['sensor_name'].')</h3>';
-      echo '<table align="center">';
-      echo '<tr><td>';
-      echo 'Минимальное значение за год <b>'.$min_val.' '.$param_unit.'</b><br>';
-      echo 'Максимальное значение за год <b>'.$max_val.' '.$param_unit.'</b><br>';
-      echo '</td></tr>';
-      echo '</table>';
-
-      if ($sensor['cnt']>1) {
-        
-        echo '<center><img src="image_minmax.php?sensor='.$sensor['sensor'].'&param='.$sensor['param'].
-          '&type=year&year='.$year.'"></center>';
-        
-      }
-      
-    }
-
-
-  } else {
-      
-    if (!$day) {
-      
-      $next_year = $year;
-      $next_month = $month+1;
-
-      if ($next_month == 13) {
-        $next_month = 1;
-        $next_year = $next_year+1;
-      }
-
-      $next_month = sprintf('%02d',$next_month); 
-      $next_year  = sprintf('%04d',$next_year);
-      $month      = sprintf('%02d',$month);
-      $year      = sprintf('%04d',$year);
-
-      if (!$local_net) {
-
-        $filter = ' and s.is_public=1';
-  
-      } else {
-  
-        $filter = '';
-    
-      }  
-    
-
-      $q = $db -> prepare( 
-          'select  
-             date_format(day,\'%d\') as day
-           from 
-             sensors_ranges r,sensors s 
-           where 
-             s.id=r.sensor and
-             day>=str_to_date(\''.$year.'-'.$month.'-01\',\'%Y-%m-%d\') and 
-             day<str_to_date(\''.$next_year.'-'.$next_month.'-01\',\'%Y-%m-%d\')'.$filter.'
-           group by day
-           order by day'
-          );
-      $q -> execute();
-      
-      $data = $q -> fetchAll(PDO::FETCH_ASSOC);
-
-      $month_name = strftime('%B %Y',mktime(0,0,0,$month,1,$year));
-
-?>
-<h1 align="center"><?php echo 'Данные за '.$month_name; ?></h1>
-<?php          
-      foreach ($data as $row) {
-        $days [$year.$month.$row['day']] = $row['day'];
-      }
-
-      calendar($year,$month,$days,'?year='.$year.'&month='.$month.'&day=%s',3);
-             
-      if (!$local_net) {
-      
-        $filter = ' and s.is_public=1';
-                
-      } else {
-                        
-        $filter = '';
-                                    
-      }
-                                                       
-              
-      $q = $db -> prepare (
-          'select 
-             s.id sensor,p.id param,s.s_description sensor_name,p.st_description param_name,
-             count(distinct day) cnt,
-             round(min(v.min),1) min_value,
-             round(max(v.max),1) max_value,
-             u.name_short unit
-           from
-             sensors_ranges v,sensors s,st_parameters p,units u
-           where 
-             v.sensor=s.id and
-             v.parameter=p.id and
-             p.st_unit=u.id and
-             v.day>=str_to_date(\''.$year.'-'.$month.'-01\',\'%Y-%m-%d\') and 
-             v.day<str_to_date(\''.$next_year.'-'.$next_month.'-01\',\'%Y-%m-%d\')'.$filter.'
-           group by s.id,p.id,s.s_description,p.st_description
-           order by s.id,p.id'
-        );
-        
-      $q -> execute();
-      $sensors = $q -> fetchAll(PDO::FETCH_ASSOC);
-      
-      foreach ($sensors as $sensor) {
-
-        $units = get_unit($db,$sensor['param']);
-        $from_unit = $units['from'];
-        $to_unit = $units['to'];
-        $param_unit = $units['name'];
-
-        $min_val = convert_unit($db,$sensor['min_value'],$from_unit,$to_unit);
-        $max_val = convert_unit($db,$sensor['max_value'],$from_unit,$to_unit);
-      
-        echo '<h3 align="center">'.$sensor['param_name'].'('.$sensor['sensor_name'].')</h3>';
-        echo '<table align="center">';
-        echo '<tr><td>';
-        echo 'Минимальное значение за месяц <b>'.$min_val.' '.$param_unit.'</b><br>';
-        echo 'Максимальное значение за месяц <b>'.$max_val.' '.$param_unit.'</b><br>';
-        echo '</td></tr>';
-        echo '</table>';
-
-        if ($sensor['cnt']>1) {
-        
-          echo '<center><img src="image_minmax.php?sensor='.$sensor['sensor'].'&param='.$sensor['param'].
-            '&type=month&year='.$year.'&month='.$month.'"></center>';
-        
-        }
-      
-      }
-
-    } else {
-
-      $month      = sprintf('%02d',$month);
-      $year      = sprintf('%04d',$year);
-      $day       = sprintf('%02d',$day);
-
-      if (!$local_net) {
-
-        $filter = ' and s.is_public=1';
-  
-      } else {
-  
-        $filter = '';
-    
-      }
-
-
-      $q = $db -> prepare(
-           'select 
-               distinct v.sensor as sensor_id,s.s_description,p.id as param_id,p.st_description 
-            from 
-               sensors_ranges v,st_parameters p,sensors s 
-            where 
-                v.day=str_to_date(\''.$year.'-'.$month.'-'.$day.'\',\'%Y-%m-%d\')
-                and v.sensor=s.id 
-                and v.parameter=p.id'.$filter
-            );
-      $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=range&fromdate=<?php echo $year.$month.$day.'000000'; ?>&todate=<?php echo $year.$month.$day.'235959'?>"></center>
-<?php  
-
-      }                                                            
-    }
-  }
-}
-?>
-</body>
-      
\ No newline at end of file
diff --git a/web/calendar.php b/web/calendar.php
deleted file mode 100644 (file)
index 6dbef05..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-function calendar($year,$month, $days, $ref_template, $font_size) {
-
-  $firstday = mktime(0,0,0,$month,1,$year);
-  $dayofmonth = date('t',$firstday);
-
-  $day_count = 1;
-
-  $num = 0;
-
-  for($i = 0; $i < 7; $i++) {
-
-    $dayofweek = date('w', mktime(0, 0, 0, $month, $day_count, $year));
-    $dayofweek = $dayofweek - 1;
-    if($dayofweek == -1) $dayofweek = 6;
-
-    if($dayofweek == $i) {
-
-      $week[$num][$i] = $day_count;
-      $day_count++;
-
-    } else {
-
-      $week[$num][$i] = "";
-
-    }
-  }
-
-
-  while(true) {
-
-    $num++;
-
-    for($i = 0; $i < 7; $i++) {
-
-      $week[$num][$i] = $day_count;
-      $day_count++;
-
-      if($day_count > $dayofmonth) break;
-
-    }
-
-    if($day_count > $dayofmonth) break;
-
-  }
-
-  echo '<table align="center" border=1>';
-
-  for($i = 0; $i < count($week); $i++) {
-
-    echo '<tr>';
-
-    for($j = 0; $j < 7; $j++) {
-
-      if(!empty($week[$i][$j])) {
-        $str = $week[$i][$j];
-        $fstr='<font size="+'.$font_size.'">'.$str.'</font>';
-        if (!empty($days[$year.$month.sprintf('%02d',$str)])) { 
-          $href=sprintf($ref_template,$days[$year.$month.sprintf('%02d',$str)]); 
-          if($j == 5 || $j == 6) {
-            echo '<td align="right" bgcolor="mediumaquamarine"><a href='.$href.'><font color=red>'.$fstr.'</font></a></td>';
-          } else { 
-            echo '<td align="right" bgcolor="mediumaquamarine"><a href='.$href.'>'.$fstr.'</a></td>';
-          }
-        } else {
-          if($j == 5 || $j == 6) {
-            echo '<td align="right"><font color=red>'.$fstr.'</font></td>';
-          } else { 
-            echo '<td align="right">'.$fstr.'</td>';
-          }
-        }
-      }
-
-      else echo '<td>&nbsp;</td>';
-
-    }
-
-    echo '</tr>';
-
-  } 
-
-  echo '</table>';
-
-}
-
-?>
\ No newline at end of file
diff --git a/web/favicon.png b/web/favicon.png
deleted file mode 100644 (file)
index a8081d8..0000000
Binary files a/web/favicon.png and /dev/null differ
diff --git a/web/favicon.svg b/web/favicon.svg
deleted file mode 100644 (file)
index 7d502ad..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg id="svg3187" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.0" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
- <metadata id="metadata8">
-  <rdf:RDF>
-   <cc:Work rdf:about="">
-    <dc:format>image/svg+xml</dc:format>
-    <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
-    <dc:title/>
-   </cc:Work>
-  </rdf:RDF>
- </metadata>
- <path id="path2397-5" style="opacity:.3;fill-rule:evenodd;fill:#fff" d="m9 2c-1.1263 0-2.0808 0.5938-2.5938 1.4688-0.2888-0.206-0.6576-0.3126-1.0624-0.3126-0.92-1e-7 -1.6875 0.61768-1.6875 1.4062 1e-7 0.1771 0.056173 0.34346 0.125 0.5-1.0464 0.4008-1.7813 1.326-1.7813 2.3751 0 1.1271 0.8584 2.0573 2.0312 2.4063-0.0158-0.1138-0.0312-0.2256-0.0312-0.3438 0-1.3807 1.1193-2.5 2.5-2.5s2.5 1.1193 2.5 2.5c0 0.1726-0.0292 0.3373-0.0625 0.5h2.0625c1.662 0 3-1.1379 3-2.5625 0-1.1284-0.856-2.0895-2.031-2.4375 0.002-0.0488 0.031-0.1068 0.031-0.1562 0-1.5772-1.344-2.8438-3-2.8438zm-1 10.5c0 0.82843 0.67157 1.5 1.5 1.5s1.5-0.67157 1.5-1.5-0.67157-1.5-1.5-1.5-1.5 0.67157-1.5 1.5zm-3-3c0 0.828 0.6716 1.5 1.5 1.5s1.5-0.672 1.5-1.5c0-0.8284-0.6716-1.5-1.5-1.5s-1.5 0.6716-1.5 1.5zm-1 5c0 0.828 0.6716 1.5 1.5 1.5s1.5-0.672 1.5-1.5-0.6716-1.5-1.5-1.5-1.5 0.672-1.5 1.5z"/>
- <path id="path2397" style="fill-rule:evenodd;fill:#3c3c3c" d="m9 1c-1.1263 0-2.0808 0.59376-2.5938 1.4688-0.28885-0.20595-0.6577-0.3125-1.0625-0.3125-0.92-1e-7 -1.6875 0.61768-1.6875 1.4062 1e-7 0.1771 0.056173 0.34346 0.125 0.5-1.0463 0.4007-1.7812 1.3259-1.7812 2.375 0 1.1271 0.8584 2.0573 2.0312 2.4063-0.0158-0.1138-0.0312-0.2256-0.0312-0.3438 0-1.3807 1.1193-2.5 2.5-2.5s2.5 1.1193 2.5 2.5c0 0.1726-0.0292 0.3373-0.0625 0.5h2.0625c1.662 0 3-1.1379 3-2.5625 0-1.1284-0.856-2.0895-2.031-2.4375 0.002-0.0488 0.031-0.1068 0.031-0.1562 0-1.5772-1.344-2.8438-3-2.8438zm-1 10.5c0 0.82843 0.67157 1.5 1.5 1.5s1.5-0.67157 1.5-1.5-0.67157-1.5-1.5-1.5-1.5 0.67157-1.5 1.5zm-3-3c0 0.8284 0.6716 1.5 1.5 1.5s1.5-0.6716 1.5-1.5-0.6716-1.5-1.5-1.5-1.5 0.6716-1.5 1.5zm-1 5c0 0.828 0.6716 1.5 1.5 1.5s1.5-0.672 1.5-1.5-0.6716-1.5-1.5-1.5-1.5 0.672-1.5 1.5z"/>
-</svg>
diff --git a/web/graphs.php b/web/graphs.php
deleted file mode 100644 (file)
index 850d9d7..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<!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: underline; color:navy; }
-  </style>
-</head>
-<body text="black" bgcolor="silver" link="blue" vlink="#000080" alink="#FF0000">         
-<?php
-
-include('config_local.php');
-
-$client_ip = $_SERVER["REMOTE_ADDR"];
-  
-if ((strpos($client_ip, "192.168.") === 0) || (strpos($client_ip, "10.8.") === 0)
-   || (strpos($client_ip, "2a02:578:5002:8174:") === 0)
-   || (strpos($client_ip, "2a02:578:5002:196::2") === 0)) {
-              
-   $local_net = True;
-                  
-} else {
-                    
-   $local_net = False;
-               
-}
-                         
-
-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');
-
-if (!$local_net) {
-
-  $filter = ' and s.is_public=1';
-
-} else {
-
-  $filter = '';
-
-}  
-
-$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'.$filter.'
-  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>
-      
\ No newline at end of file
diff --git a/web/image.php b/web/image.php
deleted file mode 100644 (file)
index 9b6ca84..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php // content="text/plain; charset=utf-8"
-
-error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED);
-
-include ('config_local.php');
-
-require_once ('jpgraph/jpgraph.php');
-require_once ('jpgraph/jpgraph_line.php');
-require_once ('jpgraph/jpgraph_date.php');
-require_once ('jpgraph/jpgraph_scatter.php');
-require_once ('jpgraph/jpgraph_regstat.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('Ð\9dе Ð¼Ð¾Ð³Ñƒ Ð¿Ð¾Ð´ÐºÐ»ÑŽÑ‡Ð¸Ñ‚ÑŒÑ\81Ñ\8f Ðº Ð‘Д');
-
-}  
-
-$supported = imagetypes();
-if( $supported & IMG_PNG )    $img_format="png";
-elseif( $supported & IMG_GIF ) $img_format="gif";
-elseif( $supported & IMG_JPG ) $img_format="jpeg";
-elseif( $supported & IMG_WBMP ) $img_format="wbmp";
-elseif( $supported & IMG_XPM ) $img_format="xpm";
-
-$cachefilename = NULL;
-
-$db -> exec('SET CHARACTER SET utf8');
-  
-$type = $_REQUEST['type'];
-$sensor=$_REQUEST['sensor'];
-$param=$_REQUEST['param'];
-
-if ($type and $param) {
-  
-  $sensor = intval($sensor);
-  $param = intval($param);
-
-  $q = $db -> prepare(
-    'select s_description from sensors where id='.$sensor
-  );
-  $q -> execute();
-
-  while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-    $sensor_name = $row['s_description'];
-  }                                                                
-
-  $q = $db -> prepare(
-    'select st.st_dot_color,st.st_line_color,st.st_description,u.id,u.unit_group from st_parameters st,units u where st.id='.$param.' and st.st_unit=u.id'
-  );
-  $q -> execute();
-
-  while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-    $param_name = $row['st_description'];
-    $from_unit = $row['id'];
-    $unit_group = $row['unit_group'];
-    $dot_color = $row['st_dot_color'];
-    $line_color = $row['st_line_color'];
-  }                                                                
-
-  if (!empty($_COOKIE['unit_'.$unit_group])) {
-    $to_unit=intval($_COOKIE['unit_'.$unit_group]);
-  } else {
-    $to_unit=$from_unit;
-  }  
-
-  $q = $db -> prepare(
-    'select u.name_short,u.prec from units u where u.id='.$to_unit
-  );
-  $q -> execute();
-
-  while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-    $param_unit = $row['name_short'];
-    $precision = $row['prec'];
-  }                                                                
-  
-  $xdata = array();
-  $ydata = array();
-
-  if ($type == 'last24') { 
-
-    $q = $db -> prepare(
-      'select unix_timestamp(timestamp) as x,unitconv(value,'.$from_unit.','.$to_unit.') as y from sensor_values where timestamp>adddate(now(), -1) and sensor_id='.$sensor.' and parameter_id='.$param.' order by timestamp'
-    );
-
-    $bottomheight = 130;
-    $topheight = 40;
-    $sizex = 1000;
-    $sizey = 800;
-    $scale = True;
-    
-  } elseif ($type == 'last24small') {
-
-    $q = $db -> prepare(
-      'select unix_timestamp(timestamp) as x,unitconv(value,'.$from_unit.','.$to_unit.') as y from sensor_values where timestamp>adddate(now(), -1) and sensor_id='.$sensor.' and parameter_id='.$param.' order by timestamp'
-    );
-
-    $bottomheight = 20;
-    $topheight = 20;
-    $sizex = 400;
-    $sizey = 300;
-    $scale = False;
-    
-  } elseif ($type == 'range') {
-
-    $curr = intval(date('YmdHis'));
-
-    $from = intval($_REQUEST['fromdate']);
-    $to = intval($_REQUEST['todate']);
-
-    if ($curr>$to) {
-    
-        $cachefilename='meteo.'.$sensor.'.'.$param.'.'.$to_unit.'.'.$from.'-'.$to.'.'.$img_format;
-    
-    }
-
-    $q = $db -> prepare(
-      'select unix_timestamp(timestamp) as x,unitconv(value,'.$from_unit.','.$to_unit.') as y from sensor_values where timestamp>=str_to_date("'.$from.'","%Y%m%d%H%i%s") and timestamp<=str_to_date("'.$to.'","%Y%m%d%H%i%s") and sensor_id='.$sensor.' and parameter_id='.$param.' order by timestamp'
-    );
-  
-    $bottomheight = 60;
-    $topheight = 40;
-    $sizex = 1000;
-    $sizey = 800;
-    $scale = True;
-  
-  }
-
-  $g = new Graph($sizex,$sizey);
-  
-  if ($cachefilename) {
-      if ($g->cache->IsValid($cachefilename)) {
-  
-          $g->cache->StreamImgFile($g->img,$cachefilename);
-          return;
-  
-      } else {
-      
-          $timeout = 8640000;
-          $g->SetupCache($cachefilename,$timeout);
-      
-      }
-  }
-
-  $q -> execute();
-    
-  while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-    
-    $xdata[] = $row['x'];
-    $ydata[] = $row['y'];
-    
-  }                                                                
-
-
-  for ($i = 0; $i < count($xdata); ++$i) {
-
-    $total_weight=0;
-    $sum=0;
-    $maxdelta = 1800;
-    
-    for ($j = $i; $j < count($xdata); ++$j) {
-    
-      $delta = abs($xdata[$i]-$xdata[$j]);
-      if ($delta > $maxdelta) { break; }
-    
-      $weight = 1-$delta/$maxdelta;
-      $total_weight += $weight;
-      $sum += $weight*$ydata[$j];
-      
-    }
-
-    for ($j = $i-1; $j >=0 ; --$j) {
-    
-      $delta = abs($xdata[$i]-$xdata[$j]);
-      if ($delta > $maxdelta) { break; }
-    
-      $weight = 1-$delta/$maxdelta;
-      $total_weight += $weight;
-      $sum += $weight*$ydata[$j];
-      
-    }
-    
-    $new_val = $sum/$total_weight;
-    $f_ydata[$i] = $new_val; 
-    
-  }
-
-  // Create the graph
-  $g->graph_theme = null;
-
-  $g->img->SetAntiAliasing();
-
-  // We need a datlin scale since we provide both
-  // x and y coordinates for the data points, but x is unix timestamp.
-  $g->SetScale('datlin');
-  if ($scale) {
-    $g->xaxis->SetLabelAngle(90);
-  } else {
-    $g->xaxis->HideLabels(True);
-  }
-  $g->xaxis->SetPos("min");
-  $g->yaxis->SetLabelFormat("%0.".$precision."f");
-#  $g->xaxis->scale->SetTimeAlign( HOURADJ_1 );
-
-
-  if ($type!="last24small") {
-
-    // We use a scatterplot to illustrate the original
-    // contro points.
-    $splot = new ScatterPlot($ydata,$xdata);
-    $g->Add($splot);
-
-    // 
-    $splot->mark->SetFillColor($dot_color);
-    $splot->mark->SetColor($dot_color);
-    $splot->mark->SetType(MARK_FILLEDCIRCLE);
-    $splot->mark->SetSize(2);
-
-  }
-
-  $fplot = new LinePlot($f_ydata,$xdata);
-  $g->Add($fplot);
-  $fplot->SetColor($line_color);
-  $fplot->SetWeight(2);
-
-  $g->SetMargin(50,30,$topheight,$bottomheight);
-  if ($scale) {
-    $g->title->Set($sensor_name.'/'.$param_name.', '.$param_unit);
-    $g->title->SetFont(FF_DV_SANSSERIF,FS_BOLD,12);
-  }  
-  $g->SetMarginColor('lightgray');
-
-  $g->xgrid->Show();
-  $g->xgrid->SetLineStyle('dotted');
-  $g->ygrid->Show();
-  $g->ygrid->SetLineStyle('dotted');
-
-  // Add the plots to the graph and stroke
-  $g->Stroke();
-  
-} else {
-
-  header("Content-Type: text/html; charset=UTF-8");
-  die('СенÑ\81ор Ð½Ðµ Ð²Ñ‹Ð±Ñ€Ð°Ð½!');
-
-}  
-
-?>
\ No newline at end of file
diff --git a/web/image_minmax.php b/web/image_minmax.php
deleted file mode 100644 (file)
index edc1708..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-<?php // content="text/plain; charset=utf-8"
-
-error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);
-
-include ('config_local.php');
-
-require_once ('jpgraph/jpgraph.php');
-require_once ('jpgraph/jpgraph_line.php');
-require_once ('jpgraph/jpgraph_date.php');
-require_once ('jpgraph/jpgraph_scatter.php');
-require_once ('jpgraph/jpgraph_regstat.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('Не могу подключиться к БД');
-
-}  
-
-$supported = imagetypes();
-if( $supported & IMG_PNG )    $img_format="png";
-elseif( $supported & IMG_GIF ) $img_format="gif";
-elseif( $supported & IMG_JPG ) $img_format="jpeg";
-elseif( $supported & IMG_WBMP ) $img_format="wbmp";
-elseif( $supported & IMG_XPM ) $img_format="xpm";
-
-$cachefilename = NULL;
-
-$db -> exec('SET CHARACTER SET utf8');
-  
-$type = $_REQUEST['type'];
-$sensor=$_REQUEST['sensor'];
-$param=$_REQUEST['param'];
-$year=$_REQUEST['year'];
-$month=$_REQUEST['month'];
-
-if ($type and $param) {
-  
-  $sensor = intval($sensor);
-  $param = intval($param);
-
-  $q = $db -> prepare(
-    'select s_description from sensors where id='.$sensor
-  );
-  $q -> execute();
-
-  while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-    $sensor_name = $row['s_description'];
-  }                                                                
-
-  $q = $db -> prepare(
-    'select st.st_fill_color_top,st.st_fill_color_bottom,st.st_description,u.id,u.unit_group from st_parameters st,units u where st.id='.$param.' and st.st_unit=u.id'
-  );
-  $q -> execute();
-
-  while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-    $param_name = $row['st_description'];
-    $from_unit = $row['id'];
-    $unit_group = $row['unit_group'];
-    $fill_color_top=$row['st_fill_color_top'];
-    $fill_color_bottom=$row['st_fill_color_bottom'];
-  }                                                                
-
-  if (!empty($_COOKIE['unit_'.$unit_group])) {
-    $to_unit=intval($_COOKIE['unit_'.$unit_group]);
-  } else {
-    $to_unit=$from_unit;
-  }  
-
-  $q = $db -> prepare(
-    'select u.name_short from units u where u.id='.$to_unit
-  );
-  $q -> execute();
-
-  while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-    $param_unit = $row['name_short'];
-  }                     
-  
-  $xdata = array();
-  $ydata = array();
-
-  if ($type == 'month') { 
-
-    $next_year = $year;
-    $next_month = $month+1;
-
-    if ($month==12) {
-    
-      $next_year++;
-      $next_month=1;
-
-    }
-
-    $curr = date("Ym");
-    $ym=sprintf('%04d%02d',$next_year,$next_month);
-    
-    if ($curr>$ym) {
-    
-      $cachefilename='meteo.month.'.$sensor.'.'.$param.'.'.$to_unit.'.'.$year.'-'.$month.'.'.$img_format;
-    
-    }
-
-    $datestr=sprintf("%04d%02d01",$year,$month);
-    $nextdatestr=sprintf("%04d%02d01",$next_year,$next_month);
-
-    $q = $db -> prepare(
-     '
-        select 
-          x,
-          unitconv(min(min),'.$from_unit.','.$to_unit.') min_value,
-          unitconv(max(max),'.$from_unit.','.$to_unit.') max_value
-        from  (
-          select 
-            unix_timestamp(day) x,
-            min,
-            max
-          from 
-            sensors_ranges 
-          where 
-            day>=STR_TO_DATE(\''.$datestr.'\',\'%Y%m%d\')
-            and day<STR_TO_DATE(\''.$nextdatestr.'\',\'%Y%m%d\')
-            and sensor='.$sensor.'
-            and parameter='.$param.'
-          ) t group by x
-        order by x'
-    );
-
-  } elseif ($type == "year") {
-
-    $next_year = $year+1;
-
-    $curr = date("Y");
-        
-    if ($curr>$next_year) {
-                
-        $cachefilename='meteo.year.'.$sensor.'.'.$param.'.'.$year.'.'.$img_format;
-                          
-    }
-
-    $datestr=sprintf("%04d0101",$year);
-    $nextdatestr=sprintf("%04d0101",$next_year);
-
-    $q = $db -> prepare(
-      '
-        select 
-          x,
-          unitconv(min(min),'.$from_unit.','.$to_unit.') min_value,
-          unitconv(max(max),'.$from_unit.','.$to_unit.') max_value
-        from  (
-          select 
-            unix_timestamp(
-              DATE_SUB(day, INTERVAL DAYOFWEEK(day)-1 DAY)
-              ) x,
-            min,
-            max
-          from 
-            sensors_ranges
-          where 
-            day>=STR_TO_DATE(\''.$datestr.'\',\'%Y%m%d\')
-            and day<STR_TO_DATE(\''.$nextdatestr.'\',\'%Y%m%d\')
-            and sensor='.$sensor.'
-            and parameter='.$param.'
-          ) t group by x
-        order by x'
-    );
-  
-  }
-
-  $g = new Graph(640,480);
-
-  if ($cachefilename) {
-      if ($g->cache->IsValid($cachefilename)) {
-  
-          $g->cache->StreamImgFile($g->img,$cachefilename);
-          return;
-  
-      } else {
-  
-          $timeout = 8640000;
-          $g->SetupCache($cachefilename,$timeout);
-
-      }
-  }
-
-
-  $q -> execute();
-    
-  while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-    
-    $xdata[] = $row['x'];
-    $mindata[] = $row['min_value'];
-    $maxdata[] = $row['max_value'];
-    
-  }                                                                
-
-  // Create the graph
-  $g->graph_theme = null;
-
-  //$g->img->SetAntiAliasing();
-
-  // We need a linlin scale since we provide both
-  // x and y coordinates for the data points.
-  $g->SetScale('datlin');
-  $g->xaxis->SetLabelAngle(90);
-  $g->xaxis->SetPos("min");
-  $g->xaxis->scale->SetTimeAlign( MINADJ_1 );
-
-  // We use a scatterplot to illustrate the original
-  // contro points.
-
-  $bplot = new LinePlot($maxdata,$xdata);
-  $g->Add($bplot);
-  $bplot->SetColor($fill_color_top);
-  $bplot->SetFillGradient($fill_color_top.'@0.2',$fill_color_bottom.'@0.9',100,TRUE);
-  $bplot->SetFillFromYMin(TRUE);       
-  $bplot->SetWeight(4);
-
-  $aplot = new LinePlot($mindata,$xdata);
-  $g->Add($aplot);
-  $aplot->SetColor($fill_color_bottom);
-  $aplot->SetFillGradient($fill_color_bottom.'@0.2','white@0.9',100,TRUE);
-  $aplot->SetFillFromYMin(TRUE);       
-  $aplot->SetWeight(4);
-
-  $g->SetMargin(60,60,60,130);
-  $g->title->Set($sensor_name.'/'.$param_name.', '.$param_unit);
-  $g->title->SetFont(FF_DV_SANSSERIF,FS_BOLD,12);
-  $g->subtitle->Set('(минимальные и максимальные значения за период)');
-  $g->subtitle->SetColor('darkred');
-  $g->SetMarginColor('silver');
-
-  $g->xgrid->Show();
-  $g->xgrid->SetLineStyle('dotted');
-  $g->ygrid->Show();
-  $g->ygrid->SetLineStyle('dotted');
-        
-  // Add the plots to the graph and stroke
-  $g->Stroke();
-  
-} else {
-
-  header("Content-Type: text/html; charset=UTF-8");
-  die('Сенсор не выбран!');
-
-}  
-
-?>
\ No newline at end of file
diff --git a/web/index.php b/web/index.php
deleted file mode 100644 (file)
index 92a8e8e..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
-  <meta http-equiv="Refresh" content="60"> 
-  <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: underline; color:navy; }
-     .header { font-size: 16; float: left; margin: 10px;}
-     .timestamp { font-size: 16; margin: 10px;}
-     .value { font-size: 60; margin: 10px; }
-     .block { float: left; margin: 20px; }
-     .container { clear: both; }
-     .footer { clear: both; margin: 20px; font-size: 20; }
-  </style>
-</head>
-<body>         
-<div class="container">
-<?php
-
-  $client_ip = $_SERVER["REMOTE_ADDR"];
-
-  if ((strpos($client_ip, "192.168.") === 0) || (strpos($client_ip, "10.8.") === 0)
-     || (strpos($client_ip, "2a02:578:5002:8174:") === 0)
-     || (strpos($client_ip, "2a02:578:5002:196::2") === 0)) {
-   
-    $local_net = True;
-            
-  } else {
-  
-    $local_net = False;
-  
-  }
-
-include('config_local.php');
-include('units.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');
-
-if (!$local_net) {
-
-  $filter = ' and s.is_public=1'; 
-
-} else {
-
-  $filter = '';
-
-}
-
-$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 v.parameter_id=p.id  
-    and s.st_id=p.st_id
-    and p.id>=0'.$filter.'
-  order by s_description,st_description'
-  );
-$q -> execute();
-
-while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-
-  echo '<div class="block">';
-  echo '<div class="header">'.$row['s_description'].'/'.$row['st_description'].'</div>';
-
-$ql =  $db -> prepare(
-  '
-    SELECT unix_timestamp(timestamp) timestamp,DATE_FORMAT(timestamp,"%H:%i") printable,value
-    FROM
-      meteo.sensor_values 
-    WHERE 
-      sensor_id='.$row['sensor_id'].' and parameter_id='.$row['param_id'].' and timestamp>addtime(now(), -3600)
-    ORDER BY 
-      timestamp desc
-  '
-   );
-
-$ql -> execute();
-
-$printable_ts = "?";
-$val = "?";
-
-if ($rowl = $ql -> fetch(PDO::FETCH_ASSOC)) {
-
-  $timestamp = $rowl['timestamp'];
-  $printable_ts = $rowl['printable'];
-  $value = $rowl['value'];
-
-  $units = get_unit($db,$row['param_id']);
-  $from_unit = $units['from'];
-  $to_unit = $units['to'];
-  $param_unit = $units['name'];
-
-  $val = convert_unit($db,$value,$from_unit,$to_unit);
-                              
-}
-                                  
-if ($printable_ts != '?') { 
-  echo '<div class="timestamp">'.$printable_ts.'</div>';
-  echo '<div class="value">'.$val.' '.$param_unit.'</div>';
-}
-?>
-<div class="graph"><a href="image.php?sensor=<?php echo $row['sensor_id']; ?>&param=<?php echo $row['param_id']?>&type=last24"><img src="image.php?sensor=<?php echo $row['sensor_id']; ?>&param=<?php echo $row['param_id']?>&type=last24small"></a></div>
-<?php  
-
-echo "</div>";
-
-}                                                            
-  
-?>
-</div>
-<div class="footer">
-<a href="archive.php">Архивные данные</a>
-<a href="graphs.php">Подробные графики</a>
-<a href="setup.php">Настройки</a>
-</div>
-</body>
-      
\ No newline at end of file
diff --git a/web/setup.php b/web/setup.php
deleted file mode 100644 (file)
index e591264..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-
-error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);
-
-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('Не могу подключиться к БД');
-
-}  
-
-$db -> exec('SET CHARACTER SET utf8');
-
-$selected = [];
-
-if ($_REQUEST['action']=='submit') {
-
-  foreach($_REQUEST as $key=>$value) {
-  
-    if (strpos($key,'unit_')===0) {
-
-      $group_id=intval(substr($key,5));
-      $unit_id=$value;
-      setcookie('unit_'.$group_id,$unit_id,time()+86400*365*10);
-      $selected[$group_id]=$unit_id;
-      
-    }
-
-  }
-
-?>
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta http-equiv="refresh" content="2; url=index.php">
-  <meta name="GENERATOR" content="Mozilla/4.72 (X11; U; Linux 2.2.12-20smp i686) [Netscape]">
-  <title>WeatherMon (Настройки)</title>
-  <link rel="icon" href="favicon.png" />
-</head>
-<body text="black" bgcolor="silver" link="blue" vlink="#000080" alink="#FF0000">
-<h1 align="center">Сохранено...</h1>
-</body>
-<?php
-  
-} else {
-
-  foreach($_COOKIE as $key=>$value) {
-  
-    if (strpos($key,'unit_')===0) {
-
-      $group_id=intval(substr($key,5));
-      $unit_id=$value;
-      setcookie('unit_'.$group_id,$unit_id);
-      $selected[$group_id]=$unit_id;
-      
-    }
-  
-  }
-
-?>
-<!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 (Настройки)</title>
-  <link rel="icon" href="favicon.svg" />
-</head>
-<body text="black" bgcolor="silver" link="blue" vlink="#000080" alink="#FF0000">
-
-<?php
-
-  
-$q = $db -> prepare(
-  'select id,name,(select count(*) from units where unit_group=g.id) cnt from unit_groups g'
-);
-$q -> execute();
-          
-echo '<form action="setup.php" method="get">';
-while ($row = $q -> fetch(PDO::FETCH_ASSOC)) {
-  $group_id = $row['id'];
-  $group_name = $row['name'];
-  $group_cnt = $row['cnt'];
-  
-  echo '<h3 align="center">'.$group_name.'</h3>';
-
-  $q_p = $db -> prepare(
-    'select id,name from units where unit_group='.$group_id
-  );
-  
-  $q_p->execute();
-
-  echo '<center><select name="unit_'.$group_id.'" size='.$group_cnt.'>';  
-  while ($row_p = $q_p -> fetch(PDO::FETCH_ASSOC)) {
-  
-    if ($selected[$group_id]==$row_p['id']) {
-      echo '<option selected value="'.$row_p['id'].'">'.$row_p['name'].'</option>';
-    } else {
-      echo '<option value="'.$row_p['id'].'">'.$row_p['name'].'</option>';
-    }  
-  
-  }
-  echo '</select></center>';
-}
-echo '<input type="hidden" name="action" value="submit">';
-echo '<p><center><input type="submit" value="Сохранить настройки"></center>';
-echo '</form>';
-
-}
-             
-?>
-</body>
-</html>
\ No newline at end of file
diff --git a/web/units.php b/web/units.php
deleted file mode 100644 (file)
index 16ad227..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-function get_unit($db,$param) {
-
-  $qug = $db -> prepare(
-    'select u.id,u.unit_group from st_parameters st,units u where st.id='.$param.' and st.st_unit=u.id'
-  );
-  $qug -> execute();
-                                    
-  while ($row = $qug -> fetch(PDO::FETCH_ASSOC)) {
-    $from_unit = $row['id'];
-    $unit_group = $row['unit_group'];
-  }
-                                                                       
-  if (!empty($_COOKIE['unit_'.$unit_group])) {
-    $to_unit=intval($_COOKIE['unit_'.$unit_group]);
-  } else {
-    $to_unit=$from_unit;
-  }
-                                                                                                                
-  $qu = $db -> prepare(
-    'select u.name_short from units u where u.id='.$to_unit
-  );
-  $qu -> execute();
-                                                                                                                                                                 
-  while ($row = $qu -> fetch(PDO::FETCH_ASSOC)) {
-    $param_unit = $row['name_short'];
-  }
-  return Array(
-    'from' => $from_unit,
-    'to' => $to_unit,
-    'name' => $param_unit
-  );                                                                                                                                                                                    
-
-}
-
-function convert_unit($db,$value,$from,$to) {
-
-  if ($from==$to) {
-
-    $val = $value;
-
-  } else {
-
-    $qv = $db -> prepare(
-      'select round(unitconv('.$value.','.$from.','.$to.'),2) res'
-    );
-    $qv -> execute();
-                            
-    while ($row = $qv -> fetch(PDO::FETCH_ASSOC)) {
-      $val = $row['res'];
-    }
-
-  }
-                                                        
-  return $val;
-
-}
-
-?>
\ No newline at end of file