<?php
// TechlevelGet.php
// Task: Get current techlevel of a client. Returns ERR, if client not known
include "./inc/includes_common.php";
//---- General Block ----------------------------------------------------------
$InputData = GetInputData($_POST); // Will OutputReturnERROR + die() on error
$ClientId = $InputData["ClientId"]; // String value
$Strings = $InputData["Strings"]; // VarLen array of strings from client
$Ints = $InputData["Ints"]; // VarLen array of strings from client
$DbHandle = OpenDB(); // Will OutputReturnERROR + die() on error
// Check if the ClientId is in the database
//-----------------------------------------------------------------------------
if (!ClientIdExists($DbHandle, $ClientId))
{
OutputReturnERROR();
die();
}
// Get and return techlevel from database
//-----------------------------------------------------------------------------
$ClientId = mysqli_real_escape_string($DbHandle, $ClientId);
$query = "SELECT Techlevel FROM $SQL_ClientTable_GLOBAL WHERE Id='$ClientId'";
if ($result = mysqli_query($DbHandle, $query))
{
$row = mysqli_fetch_array($result);
$result->close();
$Ret = GetReturnArray();
$Ret["Status"] = Status::OK;
$Ret["Ints"] = [intval($row[0])];
OutputReturn($Ret);
}
else
{
OutputReturnERROR();
}
?>