"" && $_GET["p"]=="12345") { $themp1=$_GET["themp1"]; echo date()."Принято $themp1 \n"; $fp = fopen($themp_log, "a"); fwrite($fp, date('ymdH')." ".$themp1."\n"); fclose($fp); } // вывод изображения if($_GET["themp1"]=='') { $themps = array(); $dates = array(); $lines = file($themp_log); // sort DESC $lines = array_reverse($lines); foreach ($lines as $line_num => $line) if($line_num<45) // выборка последних N строк { $themps[]=substr($line,9,3); $dates[]=substr($line,0,8); } $themps = array_reverse($themps); $dates = array_reverse($dates); header ("Content-type: image/png"); $largeurImage = 600; $hauteurImage = 300; $im = ImageCreate ($largeurImage, $hauteurImage) or die ("Ошибка при создании изображения"); $blanc = ImageColorAllocate ($im, 255, 255, 255); $noir = ImageColorAllocate ($im, 0, 0, 0); $ser = ImageColorAllocate ($im, 150, 150, 150); $bleu = ImageColorAllocate ($im, 0, 0, 255); $red = ImageColorAllocate ($im, 255, 0, 0); $plus = ImageColorAllocate ($im, 255, 230, 230); $minus = ImageColorAllocate ($im, 230, 230, 255); $hgrads = 55; // масштаб в градусах $hmas = round($hauteurImage/$hgrads); $wmas = round(($largeurImage-20)/count($themps)); ImageFilledRectangle ($im, 10, 10, $largeurImage-10, $hauteurImage/2-10, $plus); ImageFilledRectangle ($im, 10, $hauteurImage/2-10, $largeurImage-10, $hauteurImage-10, $minus); // ось абсцисс ImageLine ($im, 10, $hauteurImage/2-11, $largeurImage-10, $hauteurImage/2-11, $noir); for($i=-6;$i<7;$i++) { imageline($im, 10, $hauteurImage/2-10-$i*$hmas*5 , $largeurImage-10, $hauteurImage/2-10-$i*$hmas*5 , $ser); ImageString ($im, 0,11 , $hauteurImage/2-20-$i*$hmas*5, $i*5, $red); } // ось ординат ImageLine ($im, 10, 10, 10, $hauteurImage-10, $noir); // расуем график $i=0; $t=0; $h=0; ImageString ($im, 0, 10+($i)*$wmas , $hauteurImage-10, substr($dates[$i],0,6), $noir); foreach ($themps as &$themp) { if($i>0) if((abs(substr($dates[$i],6,2)-$h)<3)||substr($dates[$i],6,2)=="00") ImageLine ($im, 10+($i-1)*$wmas, $hauteurImage/2-10-$t*$hmas, 10+($i)*$wmas, $hauteurImage/2-10-$themp*$hmas, $bleu); ImageString ($im, 0, 10+($i)*$wmas , $hauteurImage-20, substr($dates[$i],6,2), $noir); if($h>substr($dates[$i],6,2)) ImageString ($im, 0, 10+($i)*$wmas , $hauteurImage-10, substr($dates[$i],0,6), $noir); $t = $themp; $h=substr($dates[$i],6,2); $i++; } ImageString ($im, 5, $largeurImage-40 ,20, round($t), $red); ImagePng ($im); } ?>