| 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: 5px;
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>
<body>
<div style="width:640px; word-wrap:break-word;">
<?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\">";
//
//$myfile = fopen("extrem.txt", "w") or die("Unable to open file!");
//
// Extrem SVE AMS
echo "<h4>Ekstremni podaci za sve AMS:</h4>";
//
echo "<table border='1'>";
echo "<tr>";
echo "<th>Param</th>";
echo "<th>Min</th>";
echo "<th>Time min</th>";
echo "<th>Stanica</th>";
echo "<th>Max</th>";
echo "<th>Time Max</th>";
echo "<th>Stanica</th>";
echo "</tr>";
for ($i = 0; $i < 5; $i++) {
$sql = "Select * from datalog ORDER BY ".$param[$i]." ASC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
echo "<tr>";
echo "<td>".$paramnam[$i]."</td>";
if ($i==0) echo "<td>".round($row['baro'],1)."</td>";
if ($i==1) echo "<td>".round($row['temp'],1)."</td>";
if ($i==2) echo "<td>".round($row['humi'],0)."</td>";
if ($i==3) echo "<td>".$row['sun']."</td>";
if ($i==4) echo "<td>".$row['wind']."</td>";
echo "<td>".$row['tim']."</td>";
echo "<td>".$row['amsid']."</td>";
/*/
if ($i==0) fwrite($myfile, $row['baro']."\n");
if ($i==1) fwrite($myfile, $row['temp']."\n");
if ($i==2) fwrite($myfile, $row['humi']."\n");
if ($i==3) fwrite($myfile, $row['sun']."\n");
if ($i==4) fwrite($myfile, $row['wind']."\n");
*/
$sql = "Select * from datalog ORDER BY ".$param[$i]." DESC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
if ($i==0) echo "<td>".round($row['baro'],1)."</td>";
if ($i==1) echo "<td>".round($row['temp'],1)."</td>";
if ($i==2) echo "<td>".round($row['humi'],0)."</td>";
if ($i==3) echo "<td>".$row['sun']."</td>";
if ($i==4) echo "<td>".$row['wind']."</td>";
echo "<td>".$row['tim']."</td>";
echo "<td>".$row['amsid']."</td>";
echo "</tr>";
/*/
if ($i==0) fwrite($myfile, $row['baro']."\n");
if ($i==1) fwrite($myfile, $row['temp']."\n");
if ($i==2) fwrite($myfile, $row['humi']."\n");
if ($i==3) fwrite($myfile, $row['sun']."\n");
if ($i==4) fwrite($myfile, $row['wind']."\n");
*/
}
echo "</table>";
echo "<br>";
//
$myfilebaro = fopen("extrem-baro.txt", "w") or die("Unable to open file!");
$myfiletemp = fopen("extrem-temp.txt", "w") or die("Unable to open file!");
$myfilehumi = fopen("extrem-humi.txt", "w") or die("Unable to open file!");
$myfilesun = fopen("extrem-sun.txt", "w") or die("Unable to open file!");
$myfilewind = fopen("extrem-wind.txt", "w") or die("Unable to open file!");
// Extrem POJEDINACNE AMS
for ($j = 0; $j < $nams; $j++) {
echo "<h4>Ekstremni podaci za AMS: ".$amsnam[$j]."</h4>";
//
echo "<table border='1'>";
echo "<tr>";
echo "<th>Param</th>";
echo "<th>Min</th>";
echo "<th>Time min</th>";
echo "<th>Max</th>";
echo "<th>Time Max</th>";
echo "</tr>";
for ($i = 0; $i < 5; $i++) {
$sql = "SELECT * FROM datalog WHERE amsid='".$ams[$j]."' ORDER BY ".$param[$i]." ASC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
echo "<tr>";
echo "<td>".$paramnam[$i]."</td>";
if ($i==0) echo "<td>".round($row['baro'],1)."</td>";
if ($i==1) echo "<td>".round($row['temp'],1)."</td>";
if ($i==2) echo "<td>".round($row['humi'],0)."</td>";
if ($i==3) echo "<td>".$row['sun']."</td>";
if ($i==4) echo "<td>".$row['wind']."</td>";
echo "<td>".$row['tim']."</td>";
//
if ($i==0) fwrite($myfilebaro, $row['baro']."\n");
if ($i==1) fwrite($myfiletemp, $row['temp']."\n");
if ($i==2) fwrite($myfilehumi, $row['humi']."\n");
if ($i==3) fwrite($myfilesun, $row['sun']."\n");
if ($i==4) fwrite($myfilewind, $row['wind']."\n");
$sql = "Select * from datalog WHERE amsid='".$ams[$j]."' ORDER BY ".$param[$i]." DESC, tim DESC LIMIT 1";
$result = mysql_query($sql, $dbh) or die(mysql_error());
$row = mysql_fetch_array($result);
if ($i==0) echo "<td>".round($row['baro'],1)."</td>";
if ($i==1) echo "<td>".round($row['temp'],1)."</td>";
if ($i==2) echo "<td>".round($row['humi'],0)."</td>";
if ($i==3) echo "<td>".$row['sun']."</td>";
if ($i==4) echo "<td>".$row['wind']."</td>";
echo "<td>".$row['tim']."</td>";
echo "</tr>";
//
if ($i==0) fwrite($myfilebaro, $row['baro']."\n");
if ($i==1) fwrite($myfiletemp, $row['temp']."\n");
if ($i==2) fwrite($myfilehumi, $row['humi']."\n");
if ($i==3) fwrite($myfilesun, $row['sun']."\n");
if ($i==4) fwrite($myfilewind, $row['wind']."\n");
}
echo "</table>";
echo "<br>";
}
//
fclose($myfilebaro);
fclose($myfiletemp);
fclose($myfilehumi);
fclose($myfilesun);
fclose($myfilewind);
//
?>
<hr>
<!--
<p style='color:gray;'>M. Kukić. 1984-2017. mkukic@live.com</p>
-->
<a href="javascript:history.go(-1)"><img src="img/back.png"></a><a href='ams.php'><img src='img/hom.png'><a href="wemos-d1.htm"><img src="img/info.png"></a><a href='bar-extrem.htm'><img src='img/bar.png'></a>
</div>
</body>
</html>