102 lines
No EOL
4.8 KiB
PHP
102 lines
No EOL
4.8 KiB
PHP
<?php
|
|
/*
|
|
header("Content-Type: text/html; charset=utf-8");
|
|
error_reporting(E_ALL); ini_set('display_errors',1);
|
|
require('lib/config.php');
|
|
session_name(CONFIG_SESSION); session_start();
|
|
require('lib/mysql.class.php');
|
|
include_once('lib/class.mysms.php');
|
|
$GLOBALS['mysql'] = new mysql(CONFIG_MYSQL_HOST,CONFIG_MYSQL_USER,CONFIG_MYSQL_PW,CONFIG_MYSQL_DB);
|
|
$GLOBALS['mysql']->query("SET NAMES 'utf8'");
|
|
date_default_timezone_set('Europe/London');
|
|
error_reporting(E_ALL); ini_set('display_errors', 1);
|
|
// echo "<pre>"; print_r($ilotemp); echo "</pre>";
|
|
//----------------------------------------------------------------------------------------------------------------
|
|
//------------------------------------------------- Status Ilonexs -----------------------------------------------
|
|
//-------------------------------------------------------------------------------------------------------------
|
|
$page='https://ssl.ilonexs.de/MandarOnline/get_myexports.asp?station=2766';
|
|
$headers = @get_headers($page);
|
|
if ($headers[0]=='HTTP/1.1 200 OK') {
|
|
$html = file_get_contents($page);
|
|
$jsonrow=json_decode($html);
|
|
$ilodata2['sendungen']=$jsonrow->myexports[0]->sendungen;
|
|
$ilodata2['collies']=$jsonrow->myexports[0]->collies;
|
|
$ilodata2['gewicht']=$jsonrow->myexports[0]->gewicht;
|
|
} else {
|
|
$ilodata2['sendungen']=99;
|
|
$ilodata2['collies']=0;
|
|
$ilodata2['gewicht']=0;
|
|
}
|
|
$GLOBALS['mysql']->insert("UPDATE system SET ilo_export_send='".$ilodata2['sendungen']."' WHERE id=1");
|
|
$GLOBALS['mysql']->insert("UPDATE system SET ilo_export_pack='".$ilodata2['collies']."' WHERE id=1");
|
|
$GLOBALS['mysql']->insert("UPDATE system SET ilo_export_gewi='".$ilodata2['gewicht']."' WHERE id=1");
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------------------------------
|
|
//------------------------------------------------- Login Mysms --------------------------------------------------
|
|
//----------------------------------------------------------------------------------------------------------------
|
|
$gw = $GLOBALS['mysql']->query_single("SELECT * FROM gateway WHERE id=1");
|
|
$werta=0; $wertb=0;
|
|
$api_key = $gw['api-key'];
|
|
$msisdn = $gw['nummer'];
|
|
$smspass= $gw['password'];
|
|
$mysms = new mysms($api_key);
|
|
$login_data = array('msisdn' => $msisdn , 'password' => $smspass);
|
|
$login = $mysms->ApiCall('json', '/user/login', $login_data);
|
|
$user_info = json_decode($login);
|
|
$_SESSION['AuthToken'] = $user_info->authToken;
|
|
$mysms->setAuthToken($user_info->authToken);
|
|
//----------------------------------------------------------------------------------------------------------------
|
|
//------------------------------------------------- abfragen -----------------------------------------------------
|
|
$abfrage = $GLOBALS['mysql']->query("SELECT * FROM mitarbeiter WHERE aktiv>0");
|
|
while($rma = $abfrage->fetch_assoc()) {
|
|
//-------------- nach nummer letzte 10 Nachrichten auslesen mit status -------------
|
|
$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken'],'address' => $rma['handy'],'limit' => 10); //providing
|
|
$ergebnis = $mysms->ApiCall('json', '/user/message/get/by/conversation', $req_data); //calling method ->ApiCall
|
|
$jsonrow=json_decode($ergebnis, true);
|
|
// echo "<pre>"; print_r($jsonrow['messages']); echo "</pre>";
|
|
if (isset($jsonrow['messages'])) {
|
|
foreach($jsonrow['messages'] as $row) {
|
|
//-------------- eineghende Nachrichten
|
|
if($row['incoming'] == 1) {
|
|
$werta++;
|
|
$smstest = $GLOBALS['mysql']->query_single("SELECT * FROM log_sms WHERE messageId='".$row['messageId']."'");
|
|
//-------------- eineghende Nachrichten noch nicht in der Datenbank
|
|
if($smstest['num_rows']==0) {
|
|
$GLOBALS['mysql']->insert("INSERT INTO log_sms (messageId,nummer,text,incoming,look,gelesen,status,senddate,statusdate,e_name)
|
|
VALUES(
|
|
'".$row['messageId']."',
|
|
'".$row['address']."',
|
|
'".$row['message']."',
|
|
'".$row['incoming']."',
|
|
'".$row['locked']."',
|
|
'".$row['read']."',
|
|
'".$row['status']."',
|
|
'".substr($row['dateSent'], 0, -3)."',
|
|
'".substr($row['dateStatus'], 0, -3)."',
|
|
'".$rma['name']."'
|
|
)");
|
|
$wertb++;
|
|
}
|
|
//-------------- eineghende Nachrichten in der Datenbank updaten
|
|
else {
|
|
if($smstest['gelesen']==0) {
|
|
$GLOBALS['mysql']->insert("UPDATE log_sms SET gelesen='".$row['read']."' WHERE smsID='".$smstest['smsID']."'");
|
|
}
|
|
if($smstest['look']==1 && $row['locked']!=1) {
|
|
$GLOBALS['mysql']->insert("UPDATE log_sms SET look='".$row['locked']."' WHERE smsID='".$smstest['smsID']."'");
|
|
}
|
|
if($smstest['look']==0 && $row['locked']==1) {
|
|
$GLOBALS['mysql']->insert("UPDATE log_sms SET look='".$row['locked']."' WHERE smsID='".$smstest['smsID']."'");
|
|
}
|
|
}
|
|
}
|
|
//-------------- ausgehende Nachrichten
|
|
}
|
|
}
|
|
//sleep(1);
|
|
}
|
|
echo "fertig ".$wertb."/".$werta;
|
|
*/
|
|
?>
|