$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['WSmin']>150) $error= "WSmin too high"; 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>12 or $values["WSmax"]*0.539956803>18) and $ret==false){ exec("touch $windfile"); exec("touch $windfilezwei"); } if (($values["WSmin"]*0.539956803>25 or $values["WSmax"]*0.539956803>35) and $ret==false){ exec("touch $stormfile"); exec("touch $stormfilezwei"); } if ($values["WSmin"]*0.539956803<3){ exec("touch $bannerchange"); } $values['DIR0']=$values['DIR0']-40; if ($values['DIR0']<0)$values['DIR0']=$values['DIR0']+360; //Luftdruck auf Standort anpassen $values['RP']=$values['RP']+118; mysql_query("INSERT INTO tx_webcam_wetter(pid,tstamp,crdate,cruser_id,tempin,tempout,dp,rhi,rho,ws,wc,r1h,r24h,rtot,rp,dir0,minws,maxws,forecast) VALUES ($id,'$time','$time','2','$values[Ti]','$values[To]','$values[DP]','$values[RHi]','$values[RHo]','$values[WS]','$values[WC]','$values[R1h]','$values[R24h]','$values[Rtot]','$values[RP]','$values[DIR0]','$values[WSmin]','$values[WSmax]','$values[Forecast]')"); mysql_close($conn); $richtung=$values['DIR0']; if (($richtung < 22.5) or($richtung >= 337.5)) $w_text = "N"; if (($richtung < 67.5) and($richtung >= 22.5)) $w_text = "NO"; if (($richtung < 125.5) and($richtung >= 67.5)) $w_text = "O"; if (($richtung < 157.5) and($richtung >= 125.5)) $w_text = "SO"; if (($richtung < 202.5) and($richtung >= 157.5)) $w_text = "S"; if (($richtung < 247.5) and($richtung >= 202.5)) $w_text = "SW"; if (($richtung < 292.5) and($richtung >= 247.5)) $w_text = "W"; if (($richtung < 337.5) and($richtung >= 292.5)) $w_text = "NW"; $wettertxtfile= fopen($wetterfile, "w"); $txtfileTest= fopen("/var/www/addicted/fileadmin/webcam/test/wetter/cam.txt", "w"); $tempFile=fopen($wetterPath."temp.txt", "w"); $windMessungFile=fopen($wetterPath."wind.txt", "w"); $tempFileNord=fopen($wetterPathNord."temp.txt", "w"); $windMessungFileNord=fopen($wetterPathNord."wind.txt", "w"); if ($wettertxtfile) { $txt= ""; fwrite($tempFile,$values["To"]); fwrite($windMessungFile,round($values["WSmin"]*0.539956803,2)."-".round($values["WSmax"]*0.539956803,2)); fwrite($tempFileNord,$values["To"]); fwrite($windMessungFileNord,round($values["WSmin"]*0.539956803,2)."-".round($values["WSmax"]*0.539956803,2)); fclose($tempFileNord); fclose($windMessungFileNord); fclose($tempFile); fclose($windMessungFile); //$rp = substr($values["RP"],0,-4); fwrite($wettertxtfile,$w_text." Wind:".round($values["WSmin"]*0.539956803,2)."kts Böe:".round($values["WSmax"]*0.539956803,2)."kts ".$values["To"]."°C"); fclose($wettertxtfile); $wettertxtfile= fopen("/var/www/addicted/fileadmin/webcam/achenseenord/wetter/cam.txt", "w"); fwrite($wettertxtfile, $w_text." Wind:".round($values["WSmin"]*0.539956803,2)."kts Böe:".round($values["WSmax"]*0.539956803,2)."kts ".$values["To"]."°C"); fwrite($txtfileTest, $w_text." Wind:".round($values["WSmin"]*0.539956803,2)."kts Böe:".round($values["WSmax"]*0.539956803,2)."kts ".$values["To"]."°C"); fclose($wettertxtfile); fclose($txtfileTest); } //$txtfile= fopen($txtfile, "a"); fwrite($txtfile, date("d.m.y H:i:s")." OK!.\n"); fclose($txtfile); ?>