diff --git a/assets/functions.php b/assets/functions.php index e18cffd..de36f1c 100644 --- a/assets/functions.php +++ b/assets/functions.php @@ -2544,7 +2544,7 @@ function storeMeasurementEquipment($serialnumber){ $stmt = $pdo->prepare($sql); $stmt->execute([$identification[0],$identification[1]]); $product_measurements = $stmt->fetchAll(PDO::FETCH_ASSOC); - $product_measurements = $product_measurements[0]['measurement']; + $product_measurements = $product_measurements[0]['measurement']?? ''; if (!empty($product_measurements)){ //Only run when there is a product version found @@ -2634,7 +2634,7 @@ function storeMeasurementEquipment($serialnumber){ //EXECUTE QUERY $stmt = $pdo->prepare($sql); $stmt->execute([$data, $healthindex, $identification[2],$identification[3]]); - $equipment_data = $stmt->fetchAll(PDO::FETCH_ASSOC); + //$equipment_data = $stmt->fetchAll(PDO::FETCH_ASSOC); } } } diff --git a/cronjob.php b/cronjob.php index a14a2aa..5c0402d 100644 --- a/cronjob.php +++ b/cronjob.php @@ -62,13 +62,17 @@ foreach ($communications as $communication){ $token =''; $data = json_encode(array("username" => interface_user, "password" => interface_pw), JSON_UNESCAPED_UNICODE); +<<<<<<< HEAD +======= +>>>>>>> development //Secure data $payload = generate_payload($data); //API call $responses = ioServer('/v1/authorization', $payload); //Decode Payload if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = '400';} +<<<<<<< HEAD if ($responses === 'NOK' || $responses === '400'){ //Not allowed @@ -98,6 +102,33 @@ storeMeasurementProduct($total_results, $token); storeMeasurementEquipment(''); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +======= + +if ($responses === 'NOK' || $responses === '400'){ + //Not allowed + http_response_code(403); + exit; +} +else { + // Store data in session + $token = $responses->userkey; +} + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// close Contracts ++++++++++++++ +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +closeContract(); + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Machine learning ++++++++++++++ +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +$total_measurement = traintotalMeasurement(); +$total_results = statisticalAnalyses($total_measurement); +storeMeasurementProduct($total_results, $token); +storeMeasurementEquipment(''); + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +>>>>>>> development // GeoUpdate ++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ geolocationUpdate($token); diff --git a/firmwaretool.php b/firmwaretool.php index dc7d58e..5c46dcd 100644 --- a/firmwaretool.php +++ b/firmwaretool.php @@ -31,7 +31,7 @@ if (isset($_GET['equipmentID'])){$returnpage = 'equipment&equipmentID='.$_GET['e //SHOW BACK BUTTON ONLY FOR PORTAL USERS -if (isAllowed('dashboard',$_SESSION['profile'],$_SESSION['permission'],'R') === 0){ +if (isAllowed('dashboard',$_SESSION['profile'],$_SESSION['permission'],'R') != 0){ $view .= '
'.$button_cancel.'