Geraete-Endpunkte: Anmeldung voraussetzen
actorDetails.php, sensorDetails.php, fillActorDD.php und fillSensorDD.php fragten die homeMesh-Datenbank ab und gaben Geraetenamen samt Steuer-URLs (command_url, command_parameters.url) aus - ohne jede Zugriffspruefung. Alle vier pruefen jetzt checkLogin(), bevor sie etwas ausgeben. Aufgerufen werden sie ausschliesslich aus js/solar/autoActionFuncs.js auf der Home-Seite, also aus einer angemeldeten Sitzung; der Regeleditor funktioniert unveraendert. Die SQL war bereits sauber (intval), es fehlte nur die Autorisierung. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once("../helper.php");
|
require_once("../helper.php");
|
||||||
|
|
||||||
|
// Der Endpunkt gibt Geraetenamen und Steuer-URLs aus der homeMesh-
|
||||||
|
// Datenbank aus und war bisher ohne Anmeldung erreichbar.
|
||||||
|
if (!checkLogin()) {
|
||||||
|
http_response_code(403);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
if(isset($_GET["actorID"])){
|
if(isset($_GET["actorID"])){
|
||||||
$actorID = intval($_GET["actorID"]);
|
$actorID = intval($_GET["actorID"]);
|
||||||
$qry = "SELECT command_name, command_url, parameter_type, min_value, max_value, possible_values, command_parameters.url AS parameter_url, parameter_name FROM actor_commands LEFT JOIN command_parameters ON actor_commands.id = command_id LEFT JOIN state_types ON parameter_type = state_types.id WHERE actor_id=".$actorID;
|
$qry = "SELECT command_name, command_url, parameter_type, min_value, max_value, possible_values, command_parameters.url AS parameter_url, parameter_name FROM actor_commands LEFT JOIN command_parameters ON actor_commands.id = command_id LEFT JOIN state_types ON parameter_type = state_types.id WHERE actor_id=".$actorID;
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once("../helper.php");
|
require_once("../helper.php");
|
||||||
|
|
||||||
|
// Der Endpunkt gibt Geraetenamen und Steuer-URLs aus der homeMesh-
|
||||||
|
// Datenbank aus und war bisher ohne Anmeldung erreichbar.
|
||||||
|
if (!checkLogin()) {
|
||||||
|
http_response_code(403);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
$qry = "SELECT name, actors.id FROM actors INNER JOIN actor_commands ON actor_id = actors.id GROUP BY actors.id";
|
$qry = "SELECT name, actors.id FROM actors INNER JOIN actor_commands ON actor_id = actors.id GROUP BY actors.id";
|
||||||
$mysql = new mysqli($mysql_server, $mysql_MeshUser, $mysql_MeshPass, $mysql_MeshDB);
|
$mysql = new mysqli($mysql_server, $mysql_MeshUser, $mysql_MeshPass, $mysql_MeshDB);
|
||||||
$result = mysqli_query($mysql, $qry);
|
$result = mysqli_query($mysql, $qry);
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once("../helper.php");
|
require_once("../helper.php");
|
||||||
|
|
||||||
|
// Der Endpunkt gibt Geraetenamen und Steuer-URLs aus der homeMesh-
|
||||||
|
// Datenbank aus und war bisher ohne Anmeldung erreichbar.
|
||||||
|
if (!checkLogin()) {
|
||||||
|
http_response_code(403);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
$qry = "SELECT name, actors.id FROM actors INNER JOIN actor_states ON actor_id = actors.id GROUP BY actors.id";
|
$qry = "SELECT name, actors.id FROM actors INNER JOIN actor_states ON actor_id = actors.id GROUP BY actors.id";
|
||||||
$mysql = new mysqli($mysql_server, $mysql_MeshUser, $mysql_MeshPass, $mysql_MeshDB);
|
$mysql = new mysqli($mysql_server, $mysql_MeshUser, $mysql_MeshPass, $mysql_MeshDB);
|
||||||
$result = mysqli_query($mysql, $qry);
|
$result = mysqli_query($mysql, $qry);
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once("../helper.php");
|
require_once("../helper.php");
|
||||||
|
|
||||||
|
// Der Endpunkt gibt Geraetenamen und Steuer-URLs aus der homeMesh-
|
||||||
|
// Datenbank aus und war bisher ohne Anmeldung erreichbar.
|
||||||
|
if (!checkLogin()) {
|
||||||
|
http_response_code(403);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
if(isset($_GET["sensorID"])){
|
if(isset($_GET["sensorID"])){
|
||||||
$sensorID = intval($_GET["sensorID"]);
|
$sensorID = intval($_GET["sensorID"]);
|
||||||
$qry = "SELECT state_name, url, state_types.type, unit, current_value, possible_values FROM actor_states LEFT JOIN state_types ON state_type = state_types.id WHERE actor_id=".$sensorID;
|
$qry = "SELECT state_name, url, state_types.type, unit, current_value, possible_values FROM actor_states LEFT JOIN state_types ON state_type = state_types.id WHERE actor_id=".$sensorID;
|
||||||
|
|||||||
Reference in New Issue
Block a user