????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.48 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");
$result = $mysqli->query("SELECT * FROM tblEcoguard WHERE SensorType = 'CO2' AND SensorName = '$CO2sensor1' ORDER BY Time DESC LIMIT 1;");
while($obj = $result->fetch_object()){
$sensor_04004991 = $obj->Value;
$t_04004991 = $obj->Time;
}
$result = $mysqli->query("SELECT * FROM tblEcoguard WHERE SensorType = 'CO2' AND SensorName = '$CO2sensor2' ORDER BY Time DESC LIMIT 1;");
while($obj = $result->fetch_object()){
$sensor_04005000 = $obj->Value;
$t_04005000 = $obj->Time;
}
$Average = ($sensor_04004991 + $sensor_04005000)/2;
echo("Sensor 04004991: ($t_04004991) ".$sensor_04004991." ppm <br>");
echo("Sensor 04005000: ($t_04005000) ".$sensor_04005000." ppm <br>");
echo("Sensor average: ".$Average." ppm <br>");
if($Average > 600 && $Average < 700){
echo("> 600");
$value1 = 0.25;
$value2 = 0.26;
}else if($Average > 700 && $Average < 800){
echo("> 700");
$value1 = 0.28;
$value2 = 0.29;
}else if($Average > 800 && $Average < 900){
echo("> 800");
$value1 = 0.30;
$value2 = 0.31;
}else if($Average > 900){
echo("> 900");
$value1 = 0.40;
$value2 = 0.41;
}else{
echo("< 600");
$value1 = 0.20;
$value2 = 0.21;
}
echo("<br>".$value1 . " - ". $value2."<br>");
exec('curl -X POST http://localhost/modbus_swegon/get_register.php', $output, $retval);
echo("<br>".$output[0] . "<br>");
if($output[0] < 0.45){
exec('curl -d "value='.$value1.'&address=4" -X POST http://localhost/modbus_swegon/update_register_external.php', $output, $retval);
sleep(1);
exec('curl -d "value='.$value2.'&address=5" -X POST http://localhost/modbus_swegon/update_register_external.php', $output, $retval);
}
$mysqli->query("INSERT INTO tblControlLog VALUES(null,'".$value1."','".$value2."','".date('Y-m-d H:i:s')."','".$Average."','CO2')");
?>