????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.217.109 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/AVERAGE/ |
Upload File : |
<?php
include 'setup.php';
$link = mysql_connect( "localhost", "root", "root123" );
mysql_select_db( "energicontrol" );
$COUNT = 0;
$VALUE = 0;
$SensorText = "";
$sql = "SELECT * FROM tblAverageTemp WHERE Ethernet = '$ethernet'";
echo($sql."<br>");
$result = mysql_query( $sql );
while ( $row = mysql_fetch_assoc( $result ) ) {
$SensorText .= " SensorName = '" . $row[ 'SensorName' ] . "' or";
}
$SensorText = substr( $SensorText, 0, strlen( $SensorText ) - 3 );
$sql = "SELECT * FROM tblEcoguard WHERE SensorType = 'T' and ( $SensorText ) ORDER BY Time DESC LIMIT 10";
echo($sql."<br>");
$result = mysql_query( $sql );
$sensor_name_arr = array();
while ( $row = mysql_fetch_assoc( $result ) ) {
if(!in_array($row['SensorName'],$sensor_name_arr)){
$VALUE += round( $row[ 'Value' ], 2 );
$sensor_name_arr[] = $row['SensorName'];
$COUNT++;
echo($row['SensorName']." = ". $row[ 'Value' ] . " | ".$row[ 'Time' ]."<br>");
}
}
$AverageTemp = $VALUE / $COUNT;
echo("Average temp: ". $AverageTemp );
?>