foreach (glob($delfile) as $filename) { unlink($filename); } } $_SESSION["arraydata"] = array(); $array = file($file); $oldmin = 0; //only the data from every 10min $oldhour = 0; //only the data from every 10min $mintemp = 100; $maxtemp = -100; $counter = count($array); #Logrotate if ($logrotateUSERDEFlines + 100 < $counter and $logrotate == 'yes') { LogRotate($array, $file, $logrotateUSERDEFlines); } #echo "test1"; #print_r($array[1]); #print_r($array[1][12]); exit; ########################################################################### for ($x = 0; $x < $counter; $x++) { list($date, $f2, $f3, $f4, $f5, $f6, $f7, $f8, $f9, $f10) = preg_split("/[\\s,]+/", $array[$x]); if (($array[$x][14] != $oldmin or $array[$x][12] != $oldhour or $x == $counter - 1) and $date != "NEWLOGS") { switch ($valuefield) { case 1: $value = $date; break; case 2: $value = $f2; break;
} $array = array_reverse($array); } else { $array = file($file); } $oldmin = 0; //only the data from every 10min $oldhour = 0; //only the data from every 10min $mintemp = 100; $maxtemp = -100; $counter = count($array); #if ($maxcountHMS < $counter) {$counter=$maxcountHMS;}; #Logrotate if ($logrotateHMSlines + 100 < $counter and $logrotate == 'yes' and $DBUse != "1") { LogRotate($array, $file, $logrotateHMSlines); } #print_r($array[1]); #print_r($array[1][12]); exit; ########################################################################### if ($type == "HMS100T" or $type == "HMS100TF" or $type == "CUL_WS") { for ($x = 0; $x < $counter; $x++) { list($date, $hms, $t, $temp, $h, $hum) = preg_split("/[\\s,]+/", $array[$x]); if (($array[$x][14] != $oldmin or $array[$x][12] != $oldhour or $x == $counter - 1) and $date != "NEWLOGS") { $oldmin = $array[$x][14]; $oldhour = $array[$x][12]; array_push($_SESSION["arraydata"], array($date, $temp, $hum)); } } $resultreverse = array_reverse($_SESSION["arraydata"]); $xold = $imgmaxxhms;
$oldmin = 0; //only the data from every 10min $oldhour = 0; //only the data from every 10min $actuator = "00%"; $actuator_date = "unknown"; if ($DBUse == "1") { $counter = mysql_num_rows($sqlarray); } else { $counter = count($array); } $arraydesired = array(); $arrayactuator = array(); #Logrotate if ($logrotateFHTlines + 200 < $counter and $logrotate == 'yes' and $DBUse != "1") { LogRotate($array, $file, $logrotateFHTlines); } for ($x = 0; $x < $counter; $x++) { if ($DBUse == "1") { mysql_data_seek($sqlarray, $x); $parts = mysql_fetch_assoc($sqlarray); # $date=$parts['timestamp']; $date = str_replace(" ", "_", $parts['timestamp']); $type = $parts['reading']; $temp = $parts['value']; $array[$x] = $date . " " . $type . " " . $temp; if ($type == "actuator") { $temp = $temp . "%"; } # print "Output: ".$date." ".$type." ".$temp."<br />"; } else {
$array = array_reverse($array); #print_r($array); #debug #exit; } else { $array = file($file); } $oldmin = 0; //only the data from every 10min $oldhour = 0; //only the data from every 10min $mintemp = 100; $maxtemp = -100; $counter = count($array); #Logrotate if ($logrotateKS300lines + 200 < $counter and $logrotate == 'yes' and $DBUse != "1") { LogRotate($array, $file, $logrotateKS300lines); } # go for ($x = 0; $x < $counter; $x++) { list($date, $ks300, $t, $temp, $h, $hum, $w, $wind, $r, $rain, $ir, $israin) = preg_split("/[\\s,]+/", $array[$x]); if (($array[$x][14] != $oldmin or $array[$x][12] != $oldhour or $x == $counter - 1) and $t != "avg_day" and $date != "NEWLOGS" and $t == "T:") { $oldmin = $array[$x][14]; $oldhour = $array[$x][12]; array_push($arraydata, array($date, $temp, $hum, $wind, $rain, $israin)); } } #WS300 has Willi instead other things if ($r == "Willi:") { $willi = 1; } $resultreverse = array_reverse($arraydata);