insert("UPDATE system SET smstime='".$smstime."'"); $tmptime=$smstime-604800; for($i=0; $i < 3; $i++) { $abfrage = $GLOBALS['mysql']->query_single("SELECT * FROM log_sms WHERE status=20 and logtime>'".$tmptime."' and errorzahl!=9 limit 1"); if($abfrage['num_rows'] != 0) { // echo "
"; print_r($abfrage); echo ""; $smssender = $GLOBALS['mysql']->query_single("SELECT * FROM gateway WHERE id='".$abfrage['sender_id']."'"); $mysms = new mysms($smssender['api-key']); $login_data = array('msisdn' => $smssender['nummer'], 'password' => $smssender['password']); $login = $mysms->ApiCall('json', '/user/login', $login_data); $user_info = json_decode($login); $_SESSION['AuthToken'] = $user_info->authToken; $mysms->setAuthToken($user_info->authToken); $sms_nummer[0]=$abfrage['nummer']; $sms_text=utf8_encode ($abfrage['text'] ); $req_data = array('authToken' => $_SESSION['AuthToken'],'recipients' => $sms_nummer,'message' => $sms_text,'encoding' => 0,'smsConnectorId' => 0,'store'=>true); $ergebnis = $mysms->ApiCall('json', '/remote/sms/send', $req_data); //----------------------------------------------------------- $jsonrow=json_decode($ergebnis); if($jsonrow->errorCode==0) { //-------- if lein fehler oder msageid >0 dann schreiben 8 in datenbank oder halt fehler // echo $ergebnis; $GLOBALS['mysql']->insert("UPDATE log_sms SET status=8 WHERE smsID='".$abfrage['smsID']."'"); $GLOBALS['mysql']->insert("UPDATE log_sms SET messageId='".$jsonrow->remoteSmsSendAcks[0]->messageId."' WHERE smsID='".$abfrage['smsID']."'"); $GLOBALS['mysql']->insert("UPDATE log_sms SET errorId='".$jsonrow->errorCode."' WHERE smsID='".$abfrage['smsID']."' "); if($abfrage['tId']>0) { $GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus=8 WHERE id='".$abfrage['tId']."'"); $GLOBALS['mysql']->insert("UPDATE tourenliste SET smsid='".$jsonrow->remoteSmsSendAcks[0]->messageId."' WHERE id='".$abfrage['tId']."'"); $GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$smstime."' WHERE id='".$abfrage['tId']."'"); } } else { $GLOBALS['mysql']->insert("UPDATE log_sms SET errorzahl='".$abfrage['errorzahl']."' WHERE smsID='".$abfrage['smsID']."'"); $GLOBALS['mysql']->insert("UPDATE log_sms SET errorId='".$jsonrow->errorCode."' WHERE smsID='".$abfrage['smsID']."' "); } sleep (10); } } //mysql_close($GLOBALS['mysql']); //--------------------------------------------------------------------------------- saso copy ------------------------------------------ $jahr = (int)date('Y'); $kw = (int)date('W'); // $saso = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw."' AND jahr='".$jahr."' AND typ=19 AND erl>80 limit 1"); $saso = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw."' AND jahr='".$jahr."' AND typ=19 AND erl>80"); if($saso['num_rows'] != 0) { $rasql = new mysql(CONFIG_RASQL_HOST,CONFIG_RASQL_USER,CONFIG_RASQL_PW,CONFIG_RASQL_DB); $sdata = $rasql->query_single("SELECT * FROM tliste WHERE kw='".$kw."' AND jahr='".$jahr."' AND tour='".$saso['tour'] ."'"); if($sdata['num_rows'] != 0) { $GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$sdata['norm']."' WHERE id='".$saso['id']."'"); $GLOBALS['mysql']->insert("UPDATE tourenliste SET Pakete='".$sdata['pakete']."' WHERE id='".$saso['id']."'"); if ($saso['pakete2']==0) { $GLOBALS['mysql']->insert("UPDATE tourenliste SET pakete2='".$sdata['pakete']."' WHERE id='".$saso['id']."'"); } $GLOBALS['mysql']->insert("UPDATE tourenliste SET exemplare='".$sdata['exemplare']."' WHERE id='".$saso['id']."'"); $GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht3='".$sdata['gewicht']."' WHERE id='".$saso['id']."'"); // $GLOBALS['mysql']->insert("UPDATE tourenliste SET erl='".$sdata['ablock']."' WHERE id='".$saso['id']."'"); if ($saso['gewicht']==0) { $temp=$sdata['gewicht']+($sdata['amtsblatt']*0.068); $GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht='".$temp."' WHERE id='".$saso['id']."'"); $gew2=$sdata['gewicht'] /$sdata['pakete']; $gew5=$temp/$sdata['pakete']; } $GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht2='".$gew2."' WHERE id='".$saso['id']."'"); $GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht5='".$gew5."' WHERE id='".$saso['id']."'"); if($sdata['amtsblatt'] != 0) { $GLOBALS['mysql']->insert("UPDATE tourenliste SET amtsblatt='".$sdata['amtsblatt']."' WHERE id='".$saso['id']."'"); $GLOBALS['mysql']->insert("UPDATE tourenliste SET abnorm='".$sdata['abnorm']."' WHERE id='".$saso['id']."'"); } $GLOBALS['mysql']->insert("UPDATE tourenliste SET zeit='".$sdata['zeit']."' WHERE id='".$saso['id']."'"); //--------------------------------------------------------------------------------- $GLOBALS['mysql']->insert("UPDATE tourenliste SET erl='".$sdata['ablock']."' WHERE id='".$saso['id']."'"); } else { $GLOBALS['mysql']->insert("UPDATE tourenliste SET erl=0 WHERE id='".$saso['id']."'"); } echo "noch SaSo zu prüfen: ".$saso['num_rows']; // echo'
'; print_r($sdata); echo''; } //--------------------------------------------------------------------------------- saso copy ------------------------------------------ //------------------------------------------------------------------ Polizeimeldungen $GLOBALS['mysql']->insert("UPDATE verkehr_polizei SET status=7 WHERE status=2 "); $GLOBALS['mysql']->insert("UPDATE verkehr_polizei SET status=6 WHERE status=1 "); $pmeld='https://cdn3.atudo.net/api/4.0/pois.php?type=vwd,traffic&z=50&box=51.201291,11.919478999999999,51.512161,13.226166'; $html = file_get_contents($pmeld); $jsonrow=json_decode($html); // echo "
"; print_r($jsonrow); echo ""; for($i=0; $i < 100; $i++) { if(isset($jsonrow->pois[$i])) { if($jsonrow->pois[$i]->style!=0) { $lat=($jsonrow->pois[$i]->lat); //MeldungsID //$test=str_replace('.',',', $lat); $vdata = $GLOBALS['mysql']->query_single("SELECT * FROM verkehr_polizei WHERE lat='".$lat."'"); if($vdata['num_rows']!= 0) { $reason=utf8_decode($jsonrow->pois[$i]->reason); //Textupdate $GLOBALS['mysql']->insert("UPDATE verkehr_polizei SET reason='".$reason."' WHERE id='".$vdata['id']."'"); $confirm=($jsonrow->pois[$i]->confirm_date); //bestätigungszeit if($vdata['status']== 6) { $GLOBALS['mysql']->insert("UPDATE verkehr_polizei SET status=1 WHERE id='".$vdata['id']."'"); } if($vdata['status']== 7) { $GLOBALS['mysql']->insert("UPDATE verkehr_polizei SET status=2 WHERE id='".$vdata['id']."'"); } } else { $bid=($jsonrow->pois[$i]->id); $lat=($jsonrow->pois[$i]->lat); $lng=($jsonrow->pois[$i]->lng); $street=utf8_decode($jsonrow->pois[$i]->street); $reason=utf8_decode($jsonrow->pois[$i]->reason); $strasse=utf8_decode($jsonrow->pois[$i]->LocationLocRoadNumber); $ort=utf8_decode($jsonrow->pois[$i]->address->city); $counter=($jsonrow->pois[$i]->counter); //counter $status=1; $GLOBALS['mysql']->insert("INSERT INTO verkehr_polizei (bid,lat,lng,adresse1,adresse2,street,reason,counter,status) VALUES( '".$bid."', '".$lat."', '".$lng."', '".$ort."', '".$strasse."', '".$street."', '".$reason."', '".$counter."', '".$status."') "); } } } else { break; } } //---------------------------------------------------------------------------------------------------------- $GLOBALS['mysql']->query("DELETE FROM verkehr_polizei WHERE status=8"); $GLOBALS['mysql']->query("DELETE FROM verkehr_polizei WHERE status=9"); //---------------------------------------------------------------------------------------------------------- $GLOBALS['mysql']->insert("UPDATE verkehr_polizei SET status=9 WHERE status=7 "); $GLOBALS['mysql']->insert("UPDATE verkehr_polizei SET status=8 WHERE status=6 "); //---------------------------------------------------------------------------------------------------------- ?>