summaryrefslogtreecommitdiffstats
path: root/apis/debugrequest.php
diff options
context:
space:
mode:
authorChristoph Schulthess2017-01-17 15:24:56 +0100
committerChristoph Schulthess2017-01-17 15:24:56 +0100
commit0bb7b216ae6e278d60523766ee6051ba6ee4e74c (patch)
tree2bba17b872a672eea04e174d2955a0d36d568dd3 /apis/debugrequest.php
parent[sysconfig] Handle invalid chars in logfile when doing htmlspecialchars() (diff)
downloadslx-admin-0bb7b216ae6e278d60523766ee6051ba6ee4e74c.tar.gz
slx-admin-0bb7b216ae6e278d60523766ee6051ba6ee4e74c.tar.xz
slx-admin-0bb7b216ae6e278d60523766ee6051ba6ee4e74c.zip
added debugrequest and functions in property
Diffstat (limited to 'apis/debugrequest.php')
-rw-r--r--apis/debugrequest.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/apis/debugrequest.php b/apis/debugrequest.php
new file mode 100644
index 00000000..d9f1a169
--- /dev/null
+++ b/apis/debugrequest.php
@@ -0,0 +1,18 @@
+<?php
+
+$debug_settings = Property::getRemoteDebuggingConfig();
+if ($debug_settings["status"] !== "enabled") {
+ http_response_code(403);
+ exit;
+}
+
+$debug_request = json_decode(file_get_contents("php://input"));
+
+$validclient = Database::queryFirst("SELECT * FROM machine WHERE machineuuid = :uuid AND clientip = :ip", array(":uuid" => $debug_request["uuid"], ":ip" => $_SERVER["REMOTE_ADDR"]));
+if ($validclient == false) {
+ http_response_code(400);
+} else {
+ http_response_code(200);
+ $data = json_encode(array("uuid" => $debug_request["uuid"], "ip" => $_SERVER["REMOTE_ADDR"], "port" => $debug_request["port"]));
+ Taskmanager::submit('relay', $data, true);
+}