| 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/meteoca/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 :
******************************/
//
include "config.php";
//
echo "
<hr>
<fieldset>
<legend><h3>Mreza AMS - Čačak</h3></legend>
<table border=\"0\"></legend>";
//citanje file
$myfile = fopen("tste.txt", "r") or die("Unable to open file!");
$ts=fgets($myfile);
$te=fgets($myfile);
fclose($myfile);
echo $ts." # ".$te;
echo "<br><br>";
//
$merenja = array(0, 0, 0, 0, 0, 0);
$baro = array(0, 0, 0, 0, 0, 0);
$tem = array(0, 0, 0, 0, 0, 0);
$sun = array(0, 0, 0, 0, 0, 0);
$wind = array(0, 0, 0, 0, 0, 0);
$p6 = array(0, 0, 0, 0, 0, 0);
$p7 = array(0, 0, 0, 0, 0, 0);
$p8 = array(0, 0, 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(" ", " ", " ", " ");
//
// Merenja
for ($i = 0; $i<$nams; $i++) {
$sql ="SELECT COUNT(*) AS zapisa FROM ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$merenja[$i]= mysql_result($result, 0);
}
// 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);
$sql ="SELECT sum(p6) AS wind FROM ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$p6[$i]= mysql_result($result, 0);
$p6[$i]=round($p6[$i]/$merenja[$i],1);
$sql ="SELECT sum(p7) AS wind FROM ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$p7[$i]= mysql_result($result, 0);
$p7[$i]=round($p7[$i]/$merenja[$i],1);
$sql ="SELECT sum(p8) AS wind FROM ".$data[$i];
$result = mysql_query($sql, $dbh) or die(mysql_error());
$p8[$i]= mysql_result($result, 0);
$p8[$i]=round($p8[$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 HI</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>";
$xy=heatIndex($temp[$i],30);
echo "<td>".$xy."</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>";
//
if ($nparam>5)
{
//P6 MIN-MAX
echo "<h4>P-6</h4>";
//min
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY p6 ASC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmin[$i]= $row['p6'];
$partimmin[$i]= $row['tim'];
}
//max
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY p6 DESC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmax[$i]= $row['p6'];
$partimmax[$i]= $row['tim'];
}
//
// TAB WIND
echo "<table border='1'>";
echo "<tr>";
echo "<th>Stanica</th>";
echo "<th>Time Min</th>";
echo "<th>P6 Min</th>";
echo "<th>P6 Avr</th>";
echo "<th>P6 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>".$p6[$i]."</td>";
echo "<td>".$parmax[$i]."</td>";
echo "<td>".$partimmax[$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
}
//
if ($nparam>6)
{
//P7 MIN-MAX
echo "<h4>P-7</h4>";
//min
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY p7 ASC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmin[$i]= $row['p7'];
$partimmin[$i]= $row['tim'];
}
//max
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY p7 DESC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmax[$i]= $row['p7'];
$partimmax[$i]= $row['tim'];
}
//
// TAB WIND
echo "<table border='1'>";
echo "<tr>";
echo "<th>Stanica</th>";
echo "<th>Time Min</th>";
echo "<th>P7 Min</th>";
echo "<th>P7 Avr</th>";
echo "<th>P7 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>".$p7[$i]."</td>";
echo "<td>".$parmax[$i]."</td>";
echo "<td>".$partimmax[$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
}
//
if ($nparam>7)
{
//P8 MIN-MAX
echo "<h4>P-8</h4>";
//min
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY p8 ASC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmin[$i]= $row['p8'];
$partimmin[$i]= $row['tim'];
}
//max
for ($i = 0; $i<$nams; $i++) {
$sql = "Select * from ".$data[$i]." ORDER BY p8 DESC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
$parmax[$i]= $row['p8'];
$partimmax[$i]= $row['tim'];
}
//
// TAB WIND
echo "<table border='1'>";
echo "<tr>";
echo "<th>Stanica</th>";
echo "<th>Time Min</th>";
echo "<th>P8 Min</th>";
echo "<th>P8 Avr</th>";
echo "<th>P8 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>".$p8[$i]."</td>";
echo "<td>".$parmax[$i]."</td>";
echo "<td>".$partimmax[$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
}
//
// HUMI HI kalk
function heatIndex($T, $H){
$c1=-42.38;
$c2=2.049;
$c3=10.14;
$c4=-0.2248;
$c5=-6.838e-3;
$c6=-5.482e-2;
$c7=1.228e-3;
$c8=8.528e-4;
$c9=-1.99e-6;
$T=$T*1.8+32.0;
$A=(($c5*$T)+$c2)*$T+$c1;
$B=(($c7*$T)+$c4)*$T+$c3;
$C=(($c9*$T)+$c8)*$T+$c6;
$Rv=($C*$H+$B)*$H+$A;
$Rv=($Rv-32.0)/1.8;
return $Rv;
}
//HUMI DP kalk
function dewPoint($T, $H){
$Td=(17.271*$T)/(237.7+$T)+log($H*0.01);
$Td=(237.7*$Td)/(17.271-$Td);
return $Td;
}
//Baro Pn kalk BOSCH
// const 1/0.0000225577 i 1/5.255876=0.1902632 i 44330.76923
function baroPn($h){
$p=1013.25*pow(1.0-$h/44330.77, 5.25588);
return $p;
}
//Baro AL kalk BOSCH
function baroAl($p){
$a=44330.77*(1.0-pow($p/1013.25, 0.19026));
return $a;
}
//
//QNH kalk BOSCH
function baroQNH($h, $p){
$pq=$p/pow(1.0-$h/44330.77, 5.25588);
return $pq;
}
//
// Zaokruzi 10
function round($ds){
$ds=round($ds*10.0)/10.0;
return $ds;
}
// Zaokruzi 100
function zaokS($ds){
$ds=round($ds*100.0)/100.0;
return $ds;
}
/*
// Calc
// GET /I?am=245 HTTP/1.1
function calcN(String tx){
tx=tx.substring(10,tx.length()-9);
float nx=tx.toFloat();
request[5] = 'C';
return nx;
}
// Write Time Stamp
function WtmSt(byte w, byte ad){
DateTime now = rtc.now();
Tim[ad+w*4+1]=now.hour(); Tim[ad+w*4+2]=now.minute(); Tim[ad+w*4+3]=now.day(); Tim[ad+w*4+4]=now.month(); //now.second()
return;
}
// Read Time Stamp
function RtmSt(byte w, byte ad){
s=Tim[ad+w*4+1]; m=Tim[ad+w*4+2]; d=Tim[ad+w*4+3]; n=Tim[ad+w*4+4];
return;
}
// Err Time Stamp
function EtmSt(int e){
DateTime now = rtc.now();
rtc.adjust(DateTime(now.year(),now.month(),now.day(),now.hour(),now.minute(),(now.second()+e)));
return;
}
*/
?>
<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>