| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/projects/police/prog/ |
Upload File : |
<!DOCTYPE html>
<html>
<style>
table, th, td {
border: 1px solid black;
}
th, td {
padding: 4px;
text-align: center;
}
</style>
<head>
<link rel='shortcut icon' type='image/png' href='favicon.png'/>
<title>AMS METEOCA</title>
<script>var dan = new Date();
document.write('CET '+dan.getDate()+'.'+(dan.getMonth()+1)+'.'+dan.getFullYear()+'. - '+dan.getHours()+':'+dan.getMinutes()+':'+dan.getSeconds());
</script>
</head>
<div style="width:720px; word-wrap:break-word;">
<!--
http://192.168.213.225/MyWeb/www/meteo/numeric-tim.php?ms=03&ds=15&me=03&de=15
numeric-tim.php?ms=03&ds=15&me=03&de=15
--!>
<?php
/******************************
Project: AMS - Cacak
File :
Version: 2017-03-15
Author : M. Kukic
Note :
******************************/
//
// GET metod prenosa
//
$ys = $_GET["ys"];
$ms = $_GET["ms"];
$ds = $_GET["ds"];
$hs = $_GET["hs"];
$ns = $_GET["ns"];
//
$ye = $_GET["ye"];
$me = $_GET["me"];
$de = $_GET["de"];
$he = $_GET["he"];
$ne = $_GET["ne"];
//
include "config.php";
//pocetak
//$ys="2017";
//$ms="03";
//$ds="15";
//$hs="00";
//$ns="00";
$ss="00";
//kraj
//$ye="2017";
//$me="03";
//$de="15";
//$he="23";
//$ne="59";
$se="00";
//$ts="2017-03-15 00:00:00";
//$te="2017-03-15 23:59:00";
$ts=$ys."-".$ms."-".$ds." ".$hs.":".$ns.":00";
$te=$ye."-".$me."-".$de." ".$he.":".$ne.":00";
//
//upis u file
$myfile = fopen("tste.txt", "w") or die("Unable to open file!");
fwrite($myfile, $ts."\n");
fwrite($myfile, $te."\n");
fclose($myfile);
//
echo "
<hr>
<fieldset>
<legend><h3>Mreza AMS - Čačak</h3></legend>
<table border=\"0\">";
echo $ts." # ".$te;
echo "<br><br>";
//
$sql="truncate datatim";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$sql="INSERT INTO datatim SELECT * FROM datalog WHERE tim < '".$te."' AND tim > '".$ts."' ORDER BY id";
$result = mysql_query($sql, $dbh) or die(mysql_error());
//$ams=array('CA1','CA2','CA3','CA4','CA5','CA6');
//$amsnam=array('Alvladz.','Centar','Ljubic','Cacak-4','Cacak-5','Cacak-6');
//$data=array('datatim_1','datatim_2','datatim_3','datatim_4','datatim_5','datatim_6');
$merenja = array(0, 0, 0, 0);
$baro = array(0, 0, 0, 0);
$tem = array(0, 0, 0, 0);
$sun = array(0, 0, 0, 0);
$wind = array(0, 0, 0, 0);
$tim = array('', '', '', '');
$last = array('', '', '', '');
//
// PARAMETAR MIN-MAX
$parmin = array(0, 0, 0, 0);
$parmax = array(0, 0, 0, 0);
$partimmin = array(" ", " ", " ", " ");
$partimmax = array(" ", " ", " ", " ");
//
// Clean and Data copy
for ($i = 0; $i<$nams; $i++)
{
$sql="truncate ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$sql="INSERT INTO ".$data[$i]." SELECT * FROM datatim WHERE amsid='".$ams[$i]."'";
$result = mysql_query($sql, $dbh) or die(mysql_error());
}
//
// Statistika Merenja
echo "<h4>Uzorkovanje</h4>";
for ($i = 0; $i<$nams; $i++) {
// merenja
$sql ="SELECT COUNT(*) AS zapisa FROM ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$merenja[$i]= mysql_result($result, 0);
if ($merenja[$i]==0){
$sql = "INSERT INTO ".$data[$i]." (id,amsid,tim,baro,temp,humi,sun,wind) VALUES ('0','-',NOW(),'0','0','0','0','0')";
mysql_query($sql, $dbh) or die(mysql_error());
}
// Ukupno
$summerenja=$summerenja+$merenja[$i];
}
// TAB Merenja
echo "<table border='1'>";
echo "<tr>";
echo "<th>Stanica</th>";
echo "<th>No</th>";
echo "</tr>";
for ($i = 0; $i<$nams; $i++)
{
echo "<tr>";
echo "<td>".$amsnam[$i]."</td>";
echo "<td>".$merenja[$i]."</td>";
echo "</tr>";
}
echo "<tr>";
echo "<td>Sum</td>";
echo "<td>$summerenja</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
//
// LAST - TEKUCI
// prebaceno u AMS.PHP
//
// SUM za Average
for ($i = 0; $i<$nams; $i++)
{
$sql ="SELECT sum(baro) AS baro FROM ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$baro[$i]= mysql_result($result, 0);
$baro[$i]=round($baro[$i]/$merenja[$i],1);
$sql ="SELECT sum(temp) AS temp FROM ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$temp[$i]= mysql_result($result, 0);
$temp[$i]=round($temp[$i]/$merenja[$i],1);
$sql ="SELECT sum(humi) AS humi FROM ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$humi[$i]= mysql_result($result, 0);
$humi[$i]=round($humi[$i]/$merenja[$i],1);
$sql ="SELECT sum(sun) AS sun FROM ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$sun[$i]= mysql_result($result, 0);
$sun[$i]=round($sun[$i]/$merenja[$i],1);
$sql ="SELECT sum(wind) AS wind FROM ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$wind[$i]= mysql_result($result, 0);
$wind[$i]=round($wind[$i]/$merenja[$i],1);
}
//
//BARO MIN-MAX
echo "<h4>Atmosferski pritisak </h4>";
//min
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY baro ASC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmin[$i]= $row['baro'];
$partimmin[$i]= $row['tim'];
}
//max
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY baro DESC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmax[$i]= $row['baro'];
$partimmax[$i]= $row['tim'];
}
// TAB BARO
echo "<table border='1'>";
echo "<tr>";
echo "<th>Stanica</th>";
echo "<th>Time Min</th>";
echo "<th>Baro Min</th>";
echo "<th>Baro Avr</th>";
echo "<th>Baro Max</th>";
echo "<th>Time Max</th>";
echo "</tr>";
for ($i = 0; $i<$nams; $i++)
{
echo "<tr>";
echo "<td>".$amsnam[$i]."</td>";
echo "<td>".$partimmin[$i]."</td>";
echo "<td>".$parmin[$i]."</td>";
echo "<td>".$baro[$i]."</td>";
echo "<td>".$parmax[$i]."</td>";
echo "<td>".$partimmax[$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
//
//TEMP MIN-MAX
echo "<h4>Temperatura </h4>";
//min
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY temp ASC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmin[$i]= $row['temp'];
$partimmin[$i]= $row['tim'];
}
//max
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY temp DESC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmax[$i]= $row['temp'];
$partimmax[$i]= $row['tim'];
}
//
// TAB TEMP
echo "<table border='1'>";
echo "<tr>";
echo "<th>Stanica</th>";
echo "<th>Time Min</th>";
echo "<th>Temp Min</th>";
echo "<th>Temp Avr</th>";
echo "<th>Temp Max</th>";
echo "<th>Time Max</th>";
echo "</tr>";
for ($i = 0; $i<$nams; $i++)
{
echo "<tr>";
echo "<td>".$amsnam[$i]."</td>";
echo "<td>".$partimmin[$i]."</td>";
echo "<td>".$parmin[$i]."</td>";
echo "<td>".$temp[$i]."</td>";
echo "<td>".$parmax[$i]."</td>";
echo "<td>".$partimmax[$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
//
//HUMI MIN-MAX
echo "<h4>Vlažnost vazduha </h4>";
//min
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY humi ASC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmin[$i]= $row['humi'];
$partimmin[$i]= $row['tim'];
}
//max
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY humi DESC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmax[$i]= $row['humi'];
$partimmax[$i]= $row['tim'];
}
// TAB HUMI
echo "<table border='1'>";
echo "<tr>";
echo "<th>Stanica</th>";
echo "<th>Time Min</th>";
echo "<th>Humi Min</th>";
echo "<th>Humi Avr</th>";
echo "<th>Humi Max</th>";
echo "<th>Time Max</th>";
echo "</tr>";
for ($i = 0; $i<$nams; $i++)
{
echo "<tr>";
echo "<td>".$amsnam[$i]."</td>";
echo "<td>".$partimmin[$i]."</td>";
echo "<td>".$parmin[$i]."</td>";
echo "<td>".$humi[$i]."</td>";
echo "<td>".$parmax[$i]."</td>";
echo "<td>".$partimmax[$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
//
//SUN MIN-MAX
echo "<h4>Osunčanost </h4>";
//min
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY sun ASC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmin[$i]= $row['sun'];
$partimmin[$i]= $row['tim'];
}
//max
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY sun DESC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmax[$i]= $row['sun'];
$partimmax[$i]= $row['tim'];
}
//
// TAB SUN
echo "<table border='1'>";
echo "<tr>";
echo "<th>Stanica</th>";
echo "<th>Time Min</th>";
echo "<th>Sun Min</th>";
echo "<th>Sun Avr</th>";
echo "<th>Sun Max</th>";
echo "<th>Time Max</th>";
echo "</tr>";
for ($i = 0; $i<$nams; $i++)
{
echo "<tr>";
echo "<td>".$amsnam[$i]."</td>";
echo "<td>".$partimmin[$i]."</td>";
echo "<td>".$parmin[$i]."</td>";
echo "<td>".$sun[$i]."</td>";
echo "<td>".$parmax[$i]."</td>";
echo "<td>".$partimmax[$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
//
//WIND MIN-MAX
echo "<h4>Vetar </h4>";
//min
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY wind ASC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmin[$i]= $row['wind'];
$partimmin[$i]= $row['tim'];
}
//max
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY wind DESC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmax[$i]= $row['wind'];
$partimmax[$i]= $row['tim'];
}
//
// TAB WIND
echo "<table border='1'>";
echo "<tr>";
echo "<th>Stanica</th>";
echo "<th>Time Min</th>";
echo "<th>Wind Min</th>";
echo "<th>Wind Avr</th>";
echo "<th>Wind Max</th>";
echo "<th>Time Max</th>";
echo "</tr>";
for ($i = 0; $i<$nams; $i++)
{
echo "<tr>";
echo "<td>".$amsnam[$i]."</td>";
echo "<td>".$partimmin[$i]."</td>";
echo "<td>".$parmin[$i]."</td>";
echo "<td>".$wind[$i]."</td>";
echo "<td>".$parmax[$i]."</td>";
echo "<td>".$partimmax[$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
//
?>
<hr>
<a href="javascript:history.go(-1)"><img src="img/back.png"></a> <a href="wemos-d1.htm"><img src="img/info.png"></a>
</div>
</body>
</html>