jb-data.de/smsdata.php
2025-08-11 22:23:30 +02:00

195 lines
No EOL
11 KiB
PHP

<!DOCTYPE html>
<html lang="de">
<head>
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="resource/images/favicon.png" type="image/png">
<title>JB SCAN</title>
<link href="resource/css/style.default.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="resource/js/html5shiv.js"></script>
<script src="resource/js/respond.min.js"></script>
<![endif]-->
</head>
<?php
error_reporting(E_ALL); ini_set('display_errors',1);
require('lib/config.php');
require('lib/mysql.class.php');
$GLOBALS['mysql'] = new mysql(CONFIG_MYSQL_HOST,CONFIG_MYSQL_USER,CONFIG_MYSQL_PW,CONFIG_MYSQL_DB);
include('lib/class.mysms.php');
//include('lib/mysmsapi.php');
header("Content-Type: text/html; charset=utf-8");
$tag = (int)date('d');
$kw = (int)date('W');
$jahr = (int)date('Y');
//--------------------------------------------------------------------------------------------
$tmp1=0; $tmp2=0; $tmp3=0;
$row_logsms = $GLOBALS['mysql']->query("SELECT * FROM log_sms WHERE status!=2 and sender_id!=0");
while($row = $row_logsms->fetch_assoc()) {
echo "<pre>"; print_r($row); echo "</pre>";
$row_sender = $GLOBALS['mysql']->query_single("SELECT * FROM benutzer WHERE id='".$row['sender_id']."'");
if($row_sender['num_rows']!=0) {
$mysms = new mysms($row_sender['api-key']);
$login_data = array('msisdn' => $row_sender['nummer'], 'password' => $row_sender['passwd']);
$login = $mysms->ApiCall('json', '/user/login', $login_data);
$user_info = json_decode($login); $_SESSION['AuthToken'] = $user_info->authToken;
$req_data = array('authToken' => $_SESSION['AuthToken'], 'address'=> $row['nummer'], 'query'=> utf8_decode($row['text']));
$ergbniss = $mysms->ApiCall('json', '/user/message/search', $req_data);
// echo "<pre>"; print_r(json_decode($ergbniss)); echo "</pre>";
$jsonrow=json_decode($ergbniss);
//-----------------------------------------------------------
if(isset($jsonrow->messages[0])) {
$tmp1=$jsonrow->messages[0]->messageId; $tmp2=$jsonrow->messages[0]->status; $tmp3=$jsonrow->messages[0]->dateStatus; $tmp3=substr($tmp3, 0, -3);
if($tmp1==$row['messageId']) {
$GLOBALS['mysql']->insert("UPDATE log_sms SET status='".$tmp2."' WHERE smsID='".$row['smsID']."'");
$GLOBALS['mysql']->insert("UPDATE log_sms SET statusdate='".$tmp3."' WHERE smsID='".$row['smsID']."'");
}
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE smsid='".$row['messageId']."'");
if($row_tour['num_rows']!=0) {
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus='".$tmp2."' WHERE id='".$row_tour['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$tmp3."' WHERE id='".$row_tour['id']."'");
}
}
//-----------------------------------------------------------
if(isset($jsonrow->messages[1])) {
$tmp1=$jsonrow->messages[1]->messageId; $tmp2=$jsonrow->messages[1]->status; $tmp3=$jsonrow->messages[1]->dateStatus;
if($tmp1==$row['messageId']) {
$GLOBALS['mysql']->insert("UPDATE log_sms SET status='".$tmp2."' WHERE smsID='".$row['smsID']."'");
$GLOBALS['mysql']->insert("UPDATE log_sms SET statusdate='".$tmp3."' WHERE smsID='".$row['smsID']."'");
}
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE smsid='".$row['messageId']."'");
if($row_tour['num_rows']!=0) {
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus='".$tmp2."' WHERE id='".$row_tour['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$tmp3."' WHERE id='".$row_tour['id']."'");
}
}
//-----------------------------------------------------------
if(isset($jsonrow->messages[2])) {
$tmp1=$jsonrow->messages[2]->messageId; $tmp2=$jsonrow->messages[2]->status; $tmp3=$jsonrow->messages[2]->dateStatus;
if($tmp1==$row['messageId']) {
$GLOBALS['mysql']->insert("UPDATE log_sms SET status='".$tmp2."' WHERE smsID='".$row['smsID']."'");
$GLOBALS['mysql']->insert("UPDATE log_sms SET statusdate='".$tmp3."' WHERE smsID='".$row['smsID']."'");
}
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE smsid='".$row['messageId']."'");
if($row_tour['num_rows']!=0) {
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus='".$tmp2."' WHERE id='".$row_tour['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$tmp3."' WHERE id='".$row_tour['id']."'");
}
}
//-----------------------------------------------------------
if(isset($jsonrow->messages[3])) {
$tmp1=$jsonrow->messages[3]->messageId; $tmp2=$jsonrow->messages[3]->status; $tmp3=$jsonrow->messages[3]->dateStatus;
if($tmp1==$row['messageId']) {
$GLOBALS['mysql']->insert("UPDATE log_sms SET status='".$tmp2."' WHERE smsID='".$row['smsID']."'");
$GLOBALS['mysql']->insert("UPDATE log_sms SET statusdate='".$tmp3."' WHERE smsID='".$row['smsID']."'");
}
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE smsid='".$row['messageId']."'");
if($row_tour['num_rows']!=0) {
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus='".$tmp2."' WHERE id='".$row_tour['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$tmp3."' WHERE id='".$row_tour['id']."'");
}
}
//-----------------------------------------------------------
if(isset($jsonrow->messages[4])) {
$tmp1=$jsonrow->messages[4]->messageId; $tmp2=$jsonrow->messages[4]->status; $tmp3=$jsonrow->messages[4]->dateStatus;
if($tmp1==$row['messageId']) {
$GLOBALS['mysql']->insert("UPDATE log_sms SET status='".$tmp2."' WHERE smsID='".$row['smsID']."'");
$GLOBALS['mysql']->insert("UPDATE log_sms SET statusdate='".$tmp3."' WHERE smsID='".$row['smsID']."'");
}
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE smsid='".$row['messageId']."'");
if($row_tour['num_rows']!=0) {
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus='".$tmp2."' WHERE id='".$row_tour['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$tmp3."' WHERE id='".$row_tour['id']."'");
}
}
//-----------------------------------------------------------
if(isset($jsonrow->messages[5])) {
$tmp1=$jsonrow->messages[5]->messageId; $tmp2=$jsonrow->messages[5]->status; $tmp3=$jsonrow->messages[5]->dateStatus;
if($tmp1==$row['messageId']) {
$GLOBALS['mysql']->insert("UPDATE log_sms SET status='".$tmp2."' WHERE smsID='".$row['smsID']."'");
$GLOBALS['mysql']->insert("UPDATE log_sms SET statusdate='".$tmp3."' WHERE smsID='".$row['smsID']."'");
}
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE smsid='".$row['messageId']."'");
if($row_tour['num_rows']!=0) {
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus='".$tmp2."' WHERE id='".$row_tour['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$tmp3."' WHERE id='".$row_tour['id']."'");
}
}
//-----------------------------------------------------------
if(isset($jsonrow->messages[6])) {
$tmp1=$jsonrow->messages[6]->messageId; $tmp2=$jsonrow->messages[6]->status; $tmp3=$jsonrow->messages[6]->dateStatus;
if($tmp1==$row['messageId']) {
$GLOBALS['mysql']->insert("UPDATE log_sms SET status='".$tmp2."' WHERE smsID='".$row['smsID']."'");
$GLOBALS['mysql']->insert("UPDATE log_sms SET statusdate='".$tmp3."' WHERE smsID='".$row['smsID']."'");
}
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE smsid='".$row['messageId']."'");
if($row_tour['num_rows']!=0) {
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus='".$tmp2."' WHERE id='".$row_tour['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$tmp3."' WHERE id='".$row_tour['id']."'");
}
}
//-----------------------------------------------------------
if(isset($jsonrow->messages[7])) {
$tmp1=$jsonrow->messages[7]->messageId; $tmp2=$jsonrow->messages[7]->status; $tmp3=$jsonrow->messages[7]->dateStatus;
if($tmp1==$row['messageId']) {
$GLOBALS['mysql']->insert("UPDATE log_sms SET status='".$tmp2."' WHERE smsID='".$row['smsID']."'");
$GLOBALS['mysql']->insert("UPDATE log_sms SET statusdate='".$tmp3."' WHERE smsID='".$row['smsID']."'");
}
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE smsid='".$row['messageId']."'");
if($row_tour['num_rows']!=0) {
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus='".$tmp2."' WHERE id='".$row_tour['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$tmp3."' WHERE id='".$row_tour['id']."'");
}
}
//-----------------------------------------------------------
if(isset($jsonrow->messages[8])) {
$tmp1=$jsonrow->messages[8]->messageId; $tmp2=$jsonrow->messages[8]->status; $tmp3=$jsonrow->messages[8]->dateStatus;
if($tmp1==$row['messageId']) {
$GLOBALS['mysql']->insert("UPDATE log_sms SET status='".$tmp2."' WHERE smsID='".$row['smsID']."'");
$GLOBALS['mysql']->insert("UPDATE log_sms SET statusdate='".$tmp3."' WHERE smsID='".$row['smsID']."'");
}
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE smsid='".$row['messageId']."'");
if($row_tour['num_rows']!=0) {
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus='".$tmp2."' WHERE id='".$row_tour['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$tmp3."' WHERE id='".$row_tour['id']."'");
}
}
//-----------------------------------------------------------
if(isset($jsonrow->messages[9])) {
$tmp1=$jsonrow->messages[9]->messageId; $tmp2=$jsonrow->messages[9]->status; $tmp3=$jsonrow->messages[9]->dateStatus;
if($tmp1==$row['messageId']) {
$GLOBALS['mysql']->insert("UPDATE log_sms SET status='".$tmp2."' WHERE smsID='".$row['smsID']."'");
$GLOBALS['mysql']->insert("UPDATE log_sms SET statusdate='".$tmp3."' WHERE smsID='".$row['smsID']."'");
}
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE smsid='".$row['messageId']."'");
if($row_tour['num_rows']!=0) {
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatus='".$tmp2."' WHERE id='".$row_tour['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET smsstatusdate='".$tmp3."' WHERE id='".$row_tour['id']."'");
}
}
}
// $GLOBALS['mysql']->insert("UPDATE tourenliste SET timestamp='".date("Y-m-d H:i:s", $startzeit)."' WHERE id='".$row['id']."'");
sleep (2);
}
echo"fertig";
?>