Первоначальная версия проекта chinilich-1.0

This commit is contained in:
2026-05-10 16:49:04 +03:00
commit 9b598697c5
16 changed files with 2886 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
<?php
require_once __DIR__ . '/config.php';
require_once __DIR__ . '/glpi_api.php';
header('Content-Type: application/json');
$user = checkAuth($pdo);
if (!$user) { http_response_code(401); exit; }
$computerId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if (!$computerId) { echo json_encode(['location_id' => null]); exit; }
$glpi = new GlpiApi(GLPI_API_URL, GLPI_APP_TOKEN, GLPI_USERNAME, GLPI_PASSWORD);
$computer = $glpi->getItem('Computer', $computerId);
if ($computer && isset($computer['locations_id'])) {
echo json_encode(['location_id' => $computer['locations_id']]);
} else {
echo json_encode(['location_id' => null]);
}