/* weatherstation.php - part of the open2300 package * * Version 1.3 * * Control WS2300 weather station * * Copyright 2003,2004, Kenneth Lavrsen * This program is published under the GNU Public license */ exec("ssh chiemsee webcam_wetter",$fetcharray); $txtfile= fopen("/tmp/wetter-chiemsee-log.txt", "a"); $windfile="/tmp/wind-chiemsee.txt"; $bannerchange="/tmp/bannerchange-chiemsee.txt"; $wetterfile="/var/www/addicted/fileadmin/webcam/chiemsee/wetter/cam.txt"; $id="267"; $wetterPath="/var/www/addicted/fileadmin/webcam/chiemsee/wetter/"; if (@filemtime($windfile) < (time()-600) ){ if (file_exists($windfile)){ exec("rm $windfile"); } } if (file_exists($bannerchange)){ exec("rm $bannerchange"); } foreach ($fetcharray as $value) { list($parameter,$parvalue)=explode(" ", $value); $values["$parameter"]=$parvalue; } if (!$values){ fwrite($txtfile, date("d.m.y H:i:s")." No valid wx data.\n"); fclose($txtfile); exit; } //ist es nacht oder tag $zenith= 98; $lat= 47.5; $long= 11.5; $ret= false; $ss= date_sunset(time(), SUNFUNCS_RET_TIMESTAMP, $lat, $long, $zenith); if (time() > $ss) $ret= true; $sr= date_sunrise(time(), SUNFUNCS_RET_TIMESTAMP, $lat, $long, $zenith); if (time() < $sr) $ret= true; $error= null; if ($values['To']>50) $error= "To too high"; if ($values['To']>$values['Tomax']) $error= "To > Tomax"; if ($values['To']<$values['Tomin']) $error= "To < Tomin";; // if ($values['RP']>1200) $error= "Rp too high"; // if ($values['RP']<800) $error= "Rp too low"; if ($values['RHo']>105) $error= "RHo too high"; if (($values["WSmax"]-$values["WSmin"])>30 or round($values["WSmax"]*0.539956803,2)==49.57 or round($values["WSmax"]*0.539956803,2) > 90) $error="Windb�e ist 49.57"; if (!$error == null) { //$txtfile= fopen($txtfile, "a"); fwrite($txtfile, date("m.d.y H:i:s")." No valid wx data.\n $error"); fclose($txtfile); exit; } $dbhost = 'localhost'; $dbuser = 'addictedmysql'; $dppass = 'WAvQ4hpAS5m73vQ6'; $conn = mysql_connect($dbhost, $dbuser,$dppass) or die ('Error connecting to mysql'); $dbname = 'addicted'; mysql_select_db($dbname); $time=time(); if (($values["WSmin"]*0.539956803>18) and $ret==false){ exec("touch $windfile"); } if ($values["WSmin"]*0.539956803<3){ exec("touch $bannerchange"); } $values['DIR0']=$values['DIR0']; if ($values['DIR0']<0)$values['DIR0']=$values['DIR0']+360; //Luftdruck auf Standort anpassen $values['RP']=$values['RP']; $values['DIR0']=$values['DIR0']+180; if ($values['DIR0'] > 360) $values['DIR0'] = $values['DIR0']-360; $wassertemppath = $wetterPath."/wassertemp.txt"; if (substr(date("i"),1) == 3){ $string=file_get_contents("http://www.seeon-seebruck.de/chiemseewetter"); //echo $string; // das Suchmuster mit Delimiter und Modifer (falls vorhanden) $pattern = '
Wassertemperatur