| 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/isvtgo/ |
Upload File : |
<?php
//MIN - MAX
//$par_db="temp";
//$par_no=4;
echo "<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='1200' height='110')>";
echo "<rect x = '225' width = '800' height = '110' fill = 'rgb(246,221,204)' stroke-width = '3' stroke = 'rgb(25,111,61)' />";
echo "<g stroke='gray'>";
echo "<text x='300' y='20' font-family='Verdana' font-size='20' font-weight='bold' fill='green'>".$par_sr." - Statistički parametri: </text>";
switch ($par_db) {
case "temp":
$unit=" ºC";
break;
case "pres":
$unit=" mBar";
break;
case "humi":
$unit=" %";
break;
case "wind":
$unit=" m/s";
break;
case "sunl":
$unit=" lux";
break;
}
//$unit="oC";
$sql = "SELECT * FROM meteovtg WHERE ws ='AWS0' ORDER BY ".$par_db." ASC LIMIT 1";
$result = mysqli_query($dbh, $sql) or die(mysqli_error($dbh));
$row = mysqli_fetch_array($result);
$par=round($row[$par_db],1);
$par0=$par;
$vre=$row['time'];
$go=substr($vre,0,4);
$me=substr($vre,5,2);
$da=substr($vre,8,2);
$vr=substr($vre,11,5);
$par=$par.$unit;
echo "<text x='350' y='40' font-family='Verdana' font-size='20' font-weight='bold' fill='green'>Min: </text>";
echo "<text x='410' y='40' font-family='Verdana' font-size='20' font-weight='bold' fill='blue'>".$par." - ".$da.".".$me.".".$go.". - ".$vr."</text>";
$sql = "SELECT * FROM meteovtg WHERE ws ='AWS0' ORDER BY ".$par_db." DESC LIMIT 1";
$result = mysqli_query($dbh, $sql) or die(mysqli_error($dbh));
$row = mysqli_fetch_array($result);
$par=round($row[$par_db],1);
$par1=$par;
$vre=$row['time'];
$go=substr($vre,0,4);
$me=substr($vre,5,2);
$da=substr($vre,8,2);
$vr=substr($vre,11,5);
$par=$par.$unit;
echo "<text x='350' y='60' font-family='Verdana' font-size='20' font-weight='bold' fill='green'>Max: </text>";
echo "<text x='410' y='60' font-family='Verdana' font-size='20' font-weight='bold' fill='blue'>".$par." - ".$da.".".$me.".".$go.". - ".$vr."</text>";
$sql = "SELECT AVG(".$par_db.") FROM meteovtg WHERE ws ='AWS0'";
$result = mysqli_query($dbh, $sql) or die(mysqli_error($dbh));
$row = mysqli_fetch_array($result);
$par=round($row[0],1);
$par2=$par;
$par=$par.$unit;
echo "<text x='350' y='80' font-family='Verdana' font-size='20' font-weight='bold' fill='green'>Avg: </text>";
echo "<text x='410' y='80' font-family='Verdana' font-size='20' font-weight='bold' fill='blue'>".$par."</text>";
// Trend 1h
$sql = "SELECT * FROM meteovtg WHERE ws ='AWS0' ORDER BY time DESC LIMIT 4";
$result = mysqli_query($dbh, $sql) or die(mysqli_error($dbh));
//
$row = mysqli_fetch_array($result);
$y4=$row[$par_db];
$row = mysqli_fetch_array($result);
$y3=$row[$par_db];
$row = mysqli_fetch_array($result);
$y2=$row[$par_db];
$row = mysqli_fetch_array($result);
$y1=$row[$par_db];
//
$dy=round(($y4-$y1),1);
//
if ($dy>0.0) {
$trend="(+)";
}
if ($dy<0.0) {
$trend="(-)";
}
if ($dy==0.0) {
$trend="(=)";
}
//
echo "<text x='350' y='100' font-family='Verdana' font-size='20' font-weight='bold' fill='green'>Trend: </text>";
echo "<text x='430' y='100' font-family='Verdana' font-size='20' font-weight='bold' fill='blue'>".$trend."</text>";
echo "</svg>";
?>